How do I log errors for my PHP scripts?

Post Reply
User avatar
Spray
Staff
Staff
Posts: 518
Joined: Wed Dec 28, 2011 10:41 pm
Location: Oregon

How do I log errors for my PHP scripts?

Post by Spray » Sat Jan 11, 2014 10:22 am

You can override our default php.ini settings and log all of your site's PHP errors locally using a directory-level configuration file, known as .htaccess.

To do this, create a new file with the following contents:

Code: Select all

php_flag log_errors on
php_value error_log /usr/www/YOUR_IDENTIFIER/php_errors.log
Be sure to replace "YOUR_IDENTIFIER" with the identifier you've chosen for your webhosting.

Save this file as ".htaccess" and place it inside of the root directory for your site. By default, this will be the "public" directory. After saving this file, you should see errors written to a php_errors.log file inside of the directory specified by the file.

Post Reply