Displaying PHP errors without changing the PHP.ini

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
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Displaying PHP errors without changing the PHP.ini

Post by Grim... »

Hi there.
My host has set 'display_errors = Off' in the php.ini file to my server, so when there is an error, I just get a blank screen.

Is there any way I can get PHP to ignore this?
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

I can get to my .htaccess file, if that's any use.
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

I think using the following piece of code might resolve your problem.

Code: Select all

ini_set('display_error', 1);
error_reporting(1);


:wink:
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Yeah, but the page won't run if there's a fatal error somewhere...
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Regardless of the display_errors property, your page won't run if there is a fatal error. If you just want to see the errors displayed, use...

Code: Select all

<?php
ini_set('display_errors', 1);
?>
printf
Forum Contributor
Posts: 173
Joined: Wed Jan 12, 2005 5:24 pm

Post by printf »

But that will not work if your using Windows anything in ISAPI/SAPI, because the display errors and log errors can not be changed in memory. So if display errors is off and log errors are on in your php.ini file, you can not make errors show unless you can change the php.ini file!

pif!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

php_flag display_errors on
or something to that effect..
Post Reply