Go Back   Forum Care Forums > Development Reference Area > Php Development

Reply
 
LinkBack Thread Tools Display Modes
RE: [PHP] Can't get PHP errors to display or log consistently
Old
  (#11)
Brad Fuller
Guest
 
Posts: n/a
Default RE: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:54 AM

> -----Original Message-----
> From: Chris W. Parker [private.php?do=newpm&u=]
> Sent: Monday, March 19, 2007 1:57 PM
> Cc: php-EMAIL REMOVED
> Subject: RE: [PHP] Can't get PHP errors to display or log consistently
>
> On Friday, March 16, 2007 4:04 PM Robert Cummings
> <private.php?do=newpm&u=> said:
>
> Update:
>
> Now that I've corrected my mistake in php.ini and set the level of error
> reporting that I want I can see *most* errors.
>
> But shouldn't the following produce a visible error?
>
> <?php
>
> error_reporting(E_ALL);
> ini_set('display_errors','On');
>
> x
> echo 'hello';
>
> ?>
>
> If I comment the x I see 'hello'. If I uncomment the x I don't see
> anything.
>
>
>
> Thanks,
> Chris.


Syntax errors like that will cause a startup error, which means your code
can't be evaluated. So those 2 lines of code that turn the error reporting
on never get executed.

Make sure the ini file you're editing is the one PHP is actually using. You
can see the path to the ini file in <? phpinfo(); ?>

Also make sure you are restarting apache after editing

I believe .htaccess also can override your ini setting, so check for the
existence of one of those too

HTH,

Brad
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

RE: [PHP] Can't get PHP errors to display or log consistently
Old
  (#12)
Chris W. Parker
Guest
 
Posts: n/a
Default RE: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:54 AM

On Monday, March 19, 2007 11:28 AM Brad Fuller
<private.php?do=newpm&u=> said:

> Syntax errors like that will cause a startup error, which means your
> code
> can't be evaluated. So those 2 lines of code that turn the error
> reporting
> on never get executed.


Oooohh it's a "startup error". Didn't know that.

Now everything seems to be working the way I want it to.



Thanks!
Chris.
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] Can't get PHP errors to display or log consistently
Old
  (#13)
Richard Lynch
Guest
 
Posts: n/a
Default Re: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:54 AM

On Fri, March 16, 2007 2:30 pm, Chris W. Parker wrote:
> Using CentOS 4 and I can't get errors to display on the page AT ALL or
> log errors consistently. Some errors get logged (forgetting to us
> $this-> in a cl*** for example) but most don't.
>
> I've tried:
> * using .htaccess to set the error reporting.
> * checking and double checking my php.ini file for the correct
> setting.
> * using error_reporting(E_ALL) at the top of my page.
>
> Nothing works.
>
> When a page has an error it's goes blank. Nothing is sent to the
> client.
>
> There must be a setting somewhere that is overriding all of this. Any
> ideas?


If you have a syntax error, and PHP craps out before it can even begin
to run the script to produce output, exactly what output would you
expect to go to the browser?...

Don't display the errors, just log them.

Test the code to be sure it at least has a chance of running.

You can play with http://php.net/set_error_handler to try and do nifty
things on errors, but some errors fall ouside the pervue of that
function -- namely syntax errors caught before PHP can even begin to
run the script.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
RE: [PHP] Can't get PHP errors to display or log consistently
Old
  (#14)
Richard Lynch
Guest
 
Posts: n/a
Default RE: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:55 AM

On Mon, March 19, 2007 12:57 pm, Chris W. Parker wrote:
> On Friday, March 16, 2007 4:04 PM Robert Cummings
> <private.php?do=newpm&u=> said:
>
> Update:
>
> Now that I've corrected my mistake in php.ini and set the level of
> error
> reporting that I want I can see *most* errors.
>
> But shouldn't the following produce a visible error?
>
> <?php
>
> error_reporting(E_ALL);
> ini_set('display_errors','On');
>
> x
> echo 'hello';
>
> ?>
>
> If I comment the x I see 'hello'. If I uncomment the x I don't see
> anything.


Syntax errors caught by the compile phase abort the running of the
script long before PHP has begun any output.

Do a basic syntax check on the command line with:
php -l whatever.php


--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top