How do I log errors for my PHP scripts?

Post Reply
User avatar
Spray
Former staff
Former staff
Posts: 630
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed Dec 28, 2011 10:41 pm
Location: Oregon

How do I log errors for my PHP scripts?

Post by Spray »

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