Display and log errors for PHP

Editing the php.ini to display errors

The php.ini by default should have the errors enabled; however, for the production environment, errors can be turned off. Sometimes when developing PHP scripts you may want to turn specific errors Off or On. Displaying errors is typically turned-off for production and Enabled for development. Displaying errors is disabled for production to protect sensitive information and not interfere with the format of the pages. This section will explain how to turn error reporting On and Off.

  1. Login into your cPanel.
  2. Go to the File Manager. Select the public_html directory and click Go.
  3. Find the "Error handling and logging" section in the php.ini. You can enable the error_reporting by removing the ( ; ) from in front to the line. You can disable error_reporting by adding a ( ; ) in front of the line and add "error_reporting = none". See the following.

    Error reporting set to server default.

    ;   - Show all errors, except for notices
    ;
    ;error_reporting = E_ALL & ~E_NOTICE
    ;
    

    Error reporting set to specifically report all errors.

    ;   - Show all errors, except for notices
    ;
    error_reporting = E_ALL & ~E_NOTICE
    ;
    
  4. Next you can set the display_errors to On or Off to either show the errors on your website or not. Look for the display_errors line in the php.ini and set it to On to display errors or Off to turn errors off. The code looks like the following.
    display_errors = On
    
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

CREATE A MYSQL DATABASE IN CPANEL

Step 1: After logging into cPanel, on the Home Screen. Click on ‘MYSQL Database Wizard’...

CREATE A SUBDOMAIN IN CPANEL

Step 1: On the home screen of the cPanel, click on ‘Sub Domain’     Step 2: Enter the prefix...

CREATE ADDITIONAL FTP ACCOUNTS IN CPANEL

Step 1: On the Home screen of the cPanel, Click on FTP Accounts under ‘Files’ tab       Step...

CREATING A DOMAIN ALIAS IN CPANEL

A domain alias is useful when there are additional domain names and you want to make your website...

CREATE AN ADDON DOMAIN IN CPANEL

Step 1: On the Home screen of the cPanel, Click on the “Addon Domains”      Step 2: Add the...