How to centralise your PHP error_log
This article was posted in: Web Hosting
This article will show you how to centralise the reporting of PHP errors to a single error_log. This can make debugging a much more pleasant experience.
Define a central error_log
Most websites load a configuration file or header file before anything else. Quite often, this is called index.php and it lives in the public_html directory. Simply add the following lines of code immediately after the opening <?php tag
Simply replace [cpanel_username] with your cPanel username e.g. if your username was krystald you would add:
This will cause all errors to be recorded into error_log in your home directory.
Remember, there may be parts of your website (maybe the administration section) that don't load the index.php file in public_html, so you may have to add this directive to other initiation scripts to capture everything.