Knowledgebase: PHP / Programming
How can I enable PHP error reporting?
Posted by Brian F., Last modified by Brian F. on 06 August 2012 01:49 PM

If your application/script is not working as expected and you're not sure why, a great way to debug this would be to enable error reporting in PHP through your .htaccess. For purposes of this article we'll show instructions using cPanels built in File Manager, however these same steps can be achieved through SSH or an FTP client (we suggest FileZilla). To enable PHP error reporting:

  1. Login to cPanel for your account, and in the top left finder search for File Manager. (Picture)

  2. Select the File Manager icon, and you'll be greeted with a popup. On this dialogue, you'll want to select 'Web Root' for the directory also select 'Show Hidden Files (dotfiles)'. (Picture)

  3. Once your File Manager opens, locate your .htaccess file and click it. Once highlighted, select 'Edit' from the top navigation. You will be prompted with another dialogue box, just hit 'Edit' to continue to the editor. (Picture)

  4. Now that you're editing your .htaccess, add the following lines to your file: (Picture)

    php_flag display_errors on
    php_value error_reporting "E_ALL & ~E_STRICT & ~E_NOTICE"

    This will display errors from your PHP sites/applications to help debug any error(s) you're running into.
(20 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).