Documentation

Difference between revisions of "Managing PHP errors"

 
Line 15: Line 15:
 
Create a <code>.htaccess</code> file (for example: <code>~/www/.htaccess</code>) with this content:
 
Create a <code>.htaccess</code> file (for example: <code>~/www/.htaccess</code>) with this content:
 
  php_flag display_errors on
 
  php_flag display_errors on
 +
 +
[[Category:Webserver]]

Latest revision as of 16:13, 28 August 2019

PHP errors are not displayed by default. If an error occurs, you will simply get a blank page. This is for security reasons: this way, an attacker doesn't know about possible vulnerabilities of your website. If you want to see PHP errors, you can log them to a file, or enable the display of errors.

Logging errors to a file

If your username is foobar, create a .htaccess file (for example: ~/www/.htaccess) with this content, if you are a regular user:

php_flag log_errors on
php_value error_log /home/user/foobar/php_error.log

Or if you are an organization:

php_flag log_errors on
php_value error_log /home/org/foobar/php_error.log

Displaying errors

Create a .htaccess file (for example: ~/www/.htaccess) with this content:

php_flag display_errors on