errors not showing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

errors not showing

Post 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. ;(
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
duk
Forum Contributor
Posts: 199
Joined: Wed May 19, 2004 8:45 am
Location: London

Post by duk »

just a idea, why you dont set up a apache with php and run it on your pc...
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

try

Code: Select all

var_dump(ini_set("display_errors","on"));
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

I have that, but would have a huge database to import locally if i wanted to test the actual script.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

you have it?

What did it return?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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 :)
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Syntax error is preventing the display_errors and ini_set functions from running, that's why :)
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
Post Reply