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

Reply
 
LinkBack Thread Tools Display Modes
Can't get PHP errors to display or log consistently
Old
  (#1)
Chris W. Parker
Guest
 
Posts: n/a
Default Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

Hello,

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?


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
  (#2)
Robert Cummings
Guest
 
Posts: n/a
Default Re: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

On Fri, 2007-03-16 at 12:30 -0700, Chris W. Parker wrote:
> Hello,
>
> 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?


Is there a custom error handler in place?

Try grepping for set_error_handler.

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
   
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
  (#3)
Chris W. Parker
Guest
 
Posts: n/a
Default RE: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

On Friday, March 16, 2007 12:37 PM Robert Cummings
<private.php?do=newpm&u=> said:

> Is there a custom error handler in place?
>
> Try grepping for set_error_handler.


Not in this project. Being used in another project wouldn't count
towards this one would it?



Thanks.
   
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
  (#4)
Robert Cummings
Guest
 
Posts: n/a
Default RE: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

On Fri, 2007-03-16 at 12:45 -0700, Chris W. Parker wrote:
> On Friday, March 16, 2007 12:37 PM Robert Cummings
> <private.php?do=newpm&u=> said:
>
> > Is there a custom error handler in place?
> >
> > Try grepping for set_error_handler.

>
> Not in this project. Being used in another project wouldn't count
> towards this one would it?


If either project overrides the error handler than a custom error
handler is in place. All depends on whether the code that sets it gets
run.

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
   
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
  (#5)
Chris W. Parker
Guest
 
Posts: n/a
Default RE: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

On Friday, March 16, 2007 12:49 PM Robert Cummings
<private.php?do=newpm&u=> said:

> If either project overrides the error handler than a custom error
> handler is in place. All depends on whether the code that sets it gets
> run.


(Was at lunch.)

I see. In that case how do I override it in this project?

Can the two projects coexist without causing trouble for one another?



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
  (#6)
Jim Lucas
Guest
 
Posts: n/a
Default Re: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

Chris W. Parker wrote:
> Hello,
>
> 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?
>
>
> Thanks,
> Chris.
>


try this in a error_test.php file on your web server

[error_test.php]
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');

echo 'Trying...';

# Call undefined function
my_undefined_function();

echo ' to fail!!!';

?>

This should display an error.

Could be that the buffer isn't being dumped to the browser before a
fatal error.

Now do this

<?php phpinfo(); ?>

Look at the output_buffering, see if it is turned on and what size it is
set to. Default is either 'On' or 4096 on most systems, I would
suggest turning it off. Set it to '0' in your php.ini file.

Hope this helps.



--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different
strings. But there are times for you and me when all such things agree.

- Rush
   
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
  (#7)
Robert Cummings
Guest
 
Posts: n/a
Default RE: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

On Fri, 2007-03-16 at 14:50 -0700, Chris W. Parker wrote:
> On Friday, March 16, 2007 12:49 PM Robert Cummings
> <private.php?do=newpm&u=> said:
>
> > If either project overrides the error handler than a custom error
> > handler is in place. All depends on whether the code that sets it gets
> > run.

>
> (Was at lunch.)
>
> I see. In that case how do I override it in this project?
>
> Can the two projects coexist without causing trouble for one another?


Are you sure yet it's even being overriden in the first place?

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
   
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
  (#8)
Robert Cummings
Guest
 
Posts: n/a
Default RE: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

On Fri, 2007-03-16 at 18:58 -0400, Robert Cummings wrote:
> On Fri, 2007-03-16 at 14:50 -0700, Chris W. Parker wrote:
> > On Friday, March 16, 2007 12:49 PM Robert Cummings
> > <private.php?do=newpm&u=> said:
> >
> > > If either project overrides the error handler than a custom error
> > > handler is in place. All depends on whether the code that sets it gets
> > > run.

> >
> > (Was at lunch.)
> >
> > I see. In that case how do I override it in this project?
> >
> > Can the two projects coexist without causing trouble for one another?

>
> Are you sure yet it's even being overriden in the first place?


You can read here to see how the error handler is overriden. If it is
you can override it yourself.

On another note, it may be that some goon has prepended a function call
with @ and so all nested functions are also having their errors choked.

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
   
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
  (#9)
Robert Cummings
Guest
 
Posts: n/a
Default Re: [PHP] Can't get PHP errors to display or log consistently - 05-14-2007, 03:53 AM

On Fri, 2007-03-16 at 15:56 -0700, Jim Lucas wrote:
> Chris W. Parker wrote:
> > Hello,
> >
> > 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?
> >
> >
> > Thanks,
> > Chris.
> >

>
> try this in a error_test.php file on your web server
>
> [error_test.php]
> <?php
> error_reporting(E_ALL);
> ini_set('display_errors','On');
>
> echo 'Trying...';
>
> # Call undefined function
> my_undefined_function();
>
> echo ' to fail!!!';
>
> ?>
>
> This should display an error.
>
> Could be that the buffer isn't being dumped to the browser before a
> fatal error.


Only time I've ever seen that happen is when the process segfaults. I
almost always work with output buffering on, and have never seen a fatal
error disappear while it's enabled.

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

   
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
  (#10)
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 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.
   
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