View Full Version : Server Not Displaying Errors - Unsolved Still
TheShaner
03-09-2006, 07:30 PM
Hey all,
For some reason, my web host is no longer displaying the errors in my PHP code. Instead, it'll just display a blank page or if there is HTML before reaching any PHP code, it'll display the HTML before the PHP and then just display nothing else.
How do I turn on the error reporting again. I've put error_reporting(E_ALL); at the top of my page, but it does nothing.
Thanks for any help!
EDIT: Also tried: error_reporting(2047); and it didn't work. According to php.net, ini_set('error_reporting', E_ALL); is the same as the above, so I haven't tried this. But maybe that will override my server's configs that they've set up rather than just using error_reporting(E_ALL);???
EDIT 2: ini_set('error_reporting', E_ALL); doesn't work either after checking just now.
-Shane
ns1987
03-09-2006, 07:45 PM
iirc, the server can turn it off permanently. (Maybe safe mode?)
bustamelon
03-09-2006, 07:54 PM
Hey all,
For some reason, my web host is no longer displaying the errors in my PHP code. Instead, it'll just display a blank page or if there is HTML before reaching any PHP code, it'll display the HTML before the PHP and then just display nothing else.
How do I turn on the error reporting again. I've put error_reporting(E_ALL); at the top of my page, but it does nothing.
Thanks for any help!
EDIT: Also tried: error_reporting(2047); and it didn't work. According to php.net, ini_set('error_reporting', E_ALL); is the same as the above, so I haven't tried this. But maybe that will override my server's configs that they've set up rather than just using error_reporting(E_ALL);???
EDIT 2: ini_set('error_reporting', E_ALL); doesn't work either after checking just now.
-Shane
It is generally safer NOT to show errors, but of course sometimes you need to debug. I always get a little puzzled with version changes but try this, a sort of combo of your two attempts so far (it's all in the syntax):
<?
ini_set(error_reporting,E_ALL);
?>
In other words, just remove your quotes. If that doesn't work, you'll have to contact your host and request that they turn reporting back on, or allow you to set it when needed. Good luck!
ns1987
03-09-2006, 07:59 PM
ini_set(error_reporting,E_ALL);
That's actually an error - need to use ini_set('error_reporting', E_ALL)
(The fact that it won't show unless you have error_reporting on E_ALL or E_ALL|E_STRICT (php5) doesn't change anything - still incorrect.)
TheShaner
03-09-2006, 08:43 PM
If you read my edits, I had already tried using ini_set and like ns1987 said, you have to have the quotes. I got it straight from php.net anyway, hehe.
But unfortunately, none of the above show the errors. Do you know how frustrating it is to look through 100s of lines of code to find ONE missing semicolon or missing quotation or missing bracket or etc.?!?!?!?!
I don't care that they turned it off. I usually try and catch any errors that may happen with database interaction, file I/O, etc., because I don't want the end-user seeing any critical errors without my interaction, but minor parse errors should not exist in my code, thus they need to be reported for debugging. All I want is to be able to turn on error reporting when I need to debug!!! Ahhh!!!
-Shane
bustamelon
03-09-2006, 09:20 PM
read your post, understood. and I know the quotes are supposed to be in there, but php.net has been known to make a mistake now and then. i only suggested removing the quoes because, believe it or not, it has worked for me on more than one occasion. Granted, the server was probably incorrectly configured... but anyway, youre SOL. Gotta contact your admin.
TheShaner
03-09-2006, 09:29 PM
Well, i know php.net isn't perfect, but I also checked comments posted by others and plus that fact that if ini_set must take in a string in the first argument, you must have quotes (unless using a variable to supply the string).
Anyway, I'm starting to think that you're right and I'm SOL and must contact my provider and see what they can do for me so that I can properly debug my code. Luckily I don't make those minor parse error mistakes too often, but when i do, it takes about 15min. to find where it is in my code :mad:
-Shane
try http://us3.php.net/manual/en/ref.errorfunc.php#ini.display-errors
TheShaner
03-10-2006, 04:18 PM
Yes, I've already tried that and even went a little farther. My test site starts with:
<?
ini_set("error_reporting", 2047);
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
?>
And then I just leave out a semicolon in the body of the page, like:
<body>
<? echo "Hello World" ?>
</body>
And I get a nice, blank page that is automatically generated (meaning it doesn't have my doctype, title, body, etc.)
So I'm going to say that this can only be solved by contacting my host, correct? If so, I'll change the title to reflect this.
-Shane
I don't think that code will produce an actual error, try:
<body><? echo 'te'st'; ?></body>
TheShaner
03-10-2006, 08:13 PM
Yes, it should produce an error. Semi-colons must be used to signify the the termination of code. If not, you receive a parse error on that line. And second, that wasn't my actual test, hehe.
EDIT: And just for the hell of it, I tried with your test and same thing. Blank page. Same result.
-Shane
ns1987
03-10-2006, 08:24 PM
<?
ini_set("error_reporting", 2047);
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
?>
Doesn't work for parse errors - the code needs to be parsed before this can take effect. There is NO way to fix this without contacting server admins. In a PHP file, that is. Can do the .htaccess, but they usually turn that off, as well. <_<
try putting this in an .htaccess file in you public_html dir (or whatever is similar):
php_flag display_errors on
php_flag display_startup_errors on
php_value error_reporting 2047
if you have trouble, save the contents above as htaccess.txt then after you upload it rename it to .htaccess
marek_mar
03-10-2006, 09:11 PM
Yes, it should produce an error. Semi-colons must be used to signify the the termination of code. If not, you receive a parse error on that line.
You'd recieve an error on the next line. If there is no next line there shouldn't be an error.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.