
If you see “Apache 2.0 Handler”, then you are using DSO. Now, visit your site’s phpinfo.php page in the browser: To do so, log into cPanel, navigate to the File Manager, click the button to add a file, name the file phpinfo.php, and add the following content: If you lack root access, you can upload a phpinfo file to your site, and then check it to determine your current PHP Handler. If you are using multiple versions of PHP, you may need to determine what version of PHP your site is using to determine the correct PHP handler.

To find out what PHP Handler you are using with a cPanel server, run the following as the root user via SSH: /usr/local/cpanel/bin/rebuild_phpconf -current This will depend on what PHP Handler you are using.
#CPANEL PHP ERROR LOG HOW TO#
How to Enable PHP Error Loggingįirst, you need to decide whether you should enable PHP error logging via a php.ini file or via. Next, you can use the navigation on the far left to change into the directory that should contain the file to confirm that it was in fact created and has the appropriate permissions. You will input the details of the file to be created here: In the top left corner, you will see icons to add files and directories:Ĭlick the “+ File” button to create a new file. Navigate as follows: cPanel > Files > File ManagerĪ new window will open showing the file system. Log into your user’s cPanel account at the following URL (replacing yourdomain.tld with your actual domain): You can use cPanel’s File Manager, FTP, or SSH if the cPanel user has SSH access. If you do not have root access and need to make these changes as the cPanel user, there are a few ways you can do this. The permissions should read as follows if set to 644: -rw-r-r- cPanel User Access Do the following to view the file: ls -lah /home/cp_user/public_html/error_log To create the file under the cPanel user ‘cp_user’, you would do the following as the user root via SSH (the document root for most cPanel-hosted main domains is the public_html): cd /home/cp_user/public_htmlĪlso, be sure that the log can be written to by the user (permissions of 644 should be fine for most KnownHost systems). Go ahead and determine what settings you will be using. htaccess rule to prevent unauthorized access to this log. I typically place these in the public_html, and then also make a. You may have to create the error_log file, replacing ‘/path/to/docroot/error_log’ with the exact path to the file. The recommended settings for a development site that is not live are below: log_errors = onīoth of the examples shown above do not include an actual path. NOTE: Displaying PHP errors on a live site is a security issue so do not enable this setting on a live site! Here are the recommended settings for a live site: log_errors = on If the site is not live, then you may also choose to have the errors displayed on the site in the browser. Most of the time, you will simply choose to have PHP errors logged to a private log in a location that you specify. You should decide what log settings you need to set before enabling.

Doing so will cause PHP errors to be logged in the location you choose so that you can determine what is causing the error and work to fix it.

Or a “500 error” that doesn’t log to the Apache error log as ‘real’ 500 level errors do, then you will need to enable PHP error logging for your site to find the script error. If you have encountered the dreaded ‘white page of death’ error (that error that loads a blank page and tells you nothing regarding what is wrong). You may want to enable PHP error logging if you’re actively developing your site to aid in troubleshooting. There are several reasons you may choose to enable PHP error logging. PHP error logging for your site is an optional level of logging that can be enabled to log errors that occur with PHP code.
