AmbroseChapel Posted August 10, 2006 Share Posted August 10, 2006 Hi, I'm very much out of practice with PHP (more used to Perl) and I need some help on error messages and functions.I'm used to doing something like[code]open(FILE,'>something.txt') || die "$!";[/code]in Perl and having my code die with something useful in the output. I also use CGI::Carp's 'fatalsToBrowser' a lot to get output to the browser when something goes wrong.When I'm coding now in PHP and something's wrong, I get blank output in the browser and no hint of where to start. I can get the line number from __LINE__ but not the error message from the function. What do I have to do to see warnings and errors, as in for instance the above example -- I was doing [b]imagejpeg()[/b] output to a file and it didn't get written but I couldn't figure out why not. (Safe mode problems, it turns out, see the Manual, [url=http://au.php.net/manual/en/function.imagejpeg.php#58391]http://au.php.net/manual/en/function.imagejpeg.php#58391[/url])Apologies if this question has a very obvious answer. I have done some searching, honestly! Quote Link to comment Share on other sites More sharing options...
dsartain Posted August 10, 2006 Share Posted August 10, 2006 Check to see if you have an '@ ' before your statements and such...PHP uses that to hide the output so designers can place custom errors there. Hope this helps...if not, email me at dsartain18@yahoo.com and I'll see if I can figure anything out... Quote Link to comment Share on other sites More sharing options...
AmbroseChapel Posted August 10, 2006 Author Share Posted August 10, 2006 No there definitely isn't an at-symbol before the function.Take this as an example:[code]imagejpeg($object,'img/image.jpg');[/code]if I can't write to "img" because there's a permissions problem. How will I know it's a permissions problem? Doesn't the [b]imagejpeg()[/b] function return "insufficient permissions" or "Error writing file" or just zero?And how can I grab that error message? Quote Link to comment Share on other sites More sharing options...
DillyDong Posted August 10, 2006 Share Posted August 10, 2006 Hopefully this will remedy the problem:http://us3.php.net/error-reporting Quote Link to comment Share on other sites More sharing options...
AmbroseChapel Posted August 11, 2006 Author Share Posted August 11, 2006 OK I figured out that my hosting provider has got their "display_errors" set to "Off" in the shared php.ini, and what I did was use this to turn errors back on:[code] error_reporting ( 4096 ); ini_set ( display_errors, 1 );[/code]which seems to be what I wanted.Here's another question -- when I try to print out to the browser any variable from $_POST or $_GET my script silently dies, even with the error setting above. I'm guessing this is a security measure? It's very confusing. How can I get around that? Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 11, 2006 Share Posted August 11, 2006 [quote author=AmbroseChapel link=topic=103662.msg413564#msg413564 date=1155257789]Here's another question -- when I try to print out to the browser any variable from $_POST or $_GET my script silently dies, even with the error setting above. I'm guessing this is a security measure? It's very confusing. How can I get around that?[/quote]That sounds like either a script problem or time to dump your host. Post some of your 'non-working' code that declines to echo $_POST variables. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.