Enable private PHP Error Logging by using .htaccess file
On shared as well as VPS/Cloud or a Dedicated server, we are not able to hide error logs on websites as well as read error logs from backed to resolve application or a server level issue.
Showing errors on a website is not a good, if you are looking to establish your Business or a Online presence using website, therefore its always recommended to hide a error logs on website and save the error logs in a error_log files, so that you can read the errors and resolve it.
To hide the PHP errors from visitors insert the following code in .htaccess file
# Disable php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
Once disable the error logs for visitors enable the private PHP error logging by using following code in the .htaccess file
# enable PHP error logging
php_flag log_errors on
php_value error_log /home/path/public_html/domain/PHP_errors.log
The PHP_errors.log file needs to be permission 755 or 777.