Private PHP Error Logging by using .htaccess file

To enable private PHP error logging, First disable PHP errors. To do it, add following lines into .htaccess file.

# Disable php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off

Once you disable errors, Add following lines in to .htaccess file in order to enable private PHP error logging.

php_flag log_errors on
php_value error_log /home/user/public_html/php_errors.log

change the permission of php_errors.log file to 777 or 755 using following line.

chmod 755 /home/user/public_html/php_errors.log

or

chmod 777 /home/user/public_html/php_errors.log

Now your PHP errors will logged in to /home/user/public_html/php_errors.log file.