Jump to content

[SOLVED] PHP Error Reporting


Mateobus

Recommended Posts

Hello, I am having a very difficult time getting my errors to show on my page, particularly parse errors.  I have a big script that has a parse error (i don't know where), and it would be much easier to test my script with error reports telling me what the problem is, but instead i just get a white page.  I have played around with various settings, and I have had no luck.  Here is a snippet of the script which is having problems.

 

error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
ini_set('safe_mode', '');

 

Also, when I run phpinfo(), i get 6143 --not sure what that means.  Thanks in advance

Link to comment
Share on other sites

Both - display_startup_errors and safe_mode cannot be set in a script at all.

 

The reason why the other two lines don't help you (they work for everything except fatal parse errors) is because a parse error occurs before the code is executed and those two lines never get executed.

 

To see fatal parse error you either need to check your web server log for errors or turn on display_errors and set the error_reporting level in php.ini or a .htaccess file.

 

For a .htaccess file, use the following -

php_flag display_errors on
php_value error_reporting 6143

The 6143 value is the equivalent of E_ALL, but the constant E_ALL has no meaning outside of php.ini or a php script.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.