Trying to view errors in PHP 5.2.1

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

Trying to view errors in PHP 5.2.1

Post by mcccy005 »

I've installed PHP 5.2.1 however I can't view any errors when they occur - php just shows a blank screen if there's any errors.

I've set the following in php.ini but it does nothing:
display_errors = On
error_reporting = E_ALL & E_NOTICE & E_Strict

Originally the above was display_errors = Off and error_reporting = E_ALL
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Did you restart your server?
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

Post by mcccy005 »

WEll I did restart the computer a couple of times if that counts??
mentor
Forum Contributor
Posts: 100
Joined: Sun Mar 11, 2007 11:10 am
Location: Pakistan

Post by mentor »

in phpinfo(), confirm the value of display_errors
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

try putting

Code: Select all

error_reporting(1);
at the top of the page.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

mcccy005 wrote:WEll I did restart the computer a couple of times if that counts??
Yes, it counts.
ryuuka
Forum Contributor
Posts: 128
Joined: Tue Sep 05, 2006 8:18 am
Location: the netherlands

Post by ryuuka »

put this on top of your site just below the php opening

Code: Select all

<?php
  error_reporting(E_ALL); 
  ini_set('display_errors', TRUE);
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

E_ALL & E_NOTICE & E_Strict
This evaluates to zero.

"E_ALL | E_STRICT" is what you want.
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

Post by mcccy005 »

Awesome; thanks feyd - that worked a treat.

Also; thanks ryuuka; your method worked also (although means I don't have to put it at the top of each page, but could come in handy for debugging when I put it onto someone elses server)

Thanks.
Post Reply