Page 1 of 1

errors not showing

Posted: Fri Feb 17, 2006 7:48 am
by s.dot
i have display_errors off for the live website, but when developing and adding these lines

Code: Select all

ini_set("display_errors","on");
error_reporting(E_ALL);
I don't get syntax errors. I get warnings and notices though. but at the moment i have about a 500 line script with probably 1 or 2 errors in it and I can't find them. ;(

Posted: Fri Feb 17, 2006 7:54 am
by duk
just a idea, why you dont set up a apache with php and run it on your pc...

Posted: Fri Feb 17, 2006 7:56 am
by John Cartwright
try

Code: Select all

var_dump(ini_set("display_errors","on"));

Posted: Fri Feb 17, 2006 7:56 am
by s.dot
I have that, but would have a huge database to import locally if i wanted to test the actual script.

Posted: Fri Feb 17, 2006 7:58 am
by John Cartwright
you have it?

What did it return?

Posted: Fri Feb 17, 2006 8:01 am
by s.dot
Just tried

Code: Select all

var_dump(ini_set("display_errors","on"));
error_reporting(E_ALL);
still a blank page showing nothing

just tried a 1 and "1" instead of on, too.. no luck.
PHP 4.1

Posted: Fri Feb 17, 2006 8:05 am
by John Cartwright
make a new page and put in

Code: Select all

var_dump(ini_set("display_errors","on"));
Better yet, go modify your .htaccess :)

Posted: Fri Feb 17, 2006 8:12 am
by s.dot
i just don't understand why it will show warnings and notices but not syntax errors. if the page is completely free of syntax errors then it will show the warnings, otherwise i get nothing.

Posted: Fri Feb 17, 2006 8:32 am
by Jenk
Syntax error is preventing the display_errors and ini_set functions from running, that's why :)

Posted: Fri Feb 17, 2006 8:33 am
by jmut
scrotaye wrote:i just don't understand why it will show warnings and notices but not syntax errors. if the page is completely free of syntax errors then it will show the warnings, otherwise i get nothing.
Just a thought.
Maybe a quick command script to run through all .php files and do

Code: Select all

`php -l $filename`         //->syntax checking. Those are backticks

Posted: Fri Feb 17, 2006 12:23 pm
by feyd
yeah.. syntax errors happen before any of the code inside the file can run, therefore you won't get them displayed until it's set before php starts parsing the file like in a .htaccess or php.ini. Run it through the lint check somewhat like jmut suggested.

Posted: Fri Feb 17, 2006 12:25 pm
by Chris Corbyn
Jenk wrote:Syntax error is preventing the display_errors and ini_set functions from running, that's why :)
Agreed... make sure the ini_set() and error_reporting() are the *very first* things that happen in the php code.