How to Enable or Disable PHP's display_errors via CloudLinux Selector in Plesk? (Video)

To enable or disable PHP's display_errors directive using CloudLinux Selector in Plesk, you can follow these steps. This directive controls whether PHP errors are displayed on the web page, which is useful for debugging but should be turned off in production environments to avoid exposing sensitive information.

Step 1: Log in to Plesk

  • Open your Plesk control panel at https://your-domain.com:8443 (replace your-domain.com with your actual domain or IP address).
  • Enter your Plesk username and password to log in.

Step 2: Access PHP Settings

  • In the Plesk dashboard, go to the "Domains" section.
  • Select the domain for which you want to enable or disable display_errors.
  • Under the "Web Hosting" section, click on "PHP Settings".

Step 3: Open CloudLinux PHP Selector

  • On the PHP Settings page, look for the "PHP Selector" or "Select PHP Version" section.
  • Click on "Select PHP Version" to choose the PHP version for your domain.

Step 4: Modify display_errors Setting

  1. After selecting the desired PHP version, you’ll see a list of available PHP extensions and settings for that version.

  2. Scroll down to the "Additional Directives" or "Custom PHP Settings" section. This is where you can modify custom PHP configuration options, including display_errors.

  3. In the "Additional Directives" box, you can add custom PHP directives:

    • To enable display_errors, add the following line:

                   display_errors = On

    • To disable display_errors, add the following line:

                   display_errors = Off

Step 5: Apply the Changes

  • After modifying the display_errors directive, scroll down and click "OK" or "Apply" to save the changes.

Step 6: Verify the Changes

  • To verify that display_errors is set correctly, you can create a phpinfo.php file in the root directory of your domain.
  • Create a file named phpinfo.php and add this code to it:

          <?php

             phpinfo();

           ?>

  • Visit http://your-domain.com/phpinfo.php in your browser.
  • Look for the display_errors directive in the output. It should show either On or Off based on the setting you applied.
  • Step 7: Remove the phpinfo.php File (Optional)

    • Once you’ve verified that the setting has been applied, it’s a good practice to remove the phpinfo.php file for security reasons.

    Troubleshooting

    • If you cannot see the "Additional Directives" box, it may be due to the version of Plesk or CloudLinux settings. Make sure you have permission to modify PHP directives. If you don’t, you may need to contact your hosting provider for assistance.
    • If the display_errors directive doesn’t seem to change after following these steps, check if there are any other configuration files (like the php.ini or server-wide settings) that are overriding this directive.

    By following these steps, you can enable or disable PHP’s display_errors directive via CloudLinux Selector in Plesk. This is useful for controlling whether PHP error messages are shown to users, helping maintain security in production environments while still allowing debugging in development environments.

     
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Change the PHP Version via CloudLinux Selector in Plesk? (Video)

Changing the PHP version via CloudLinux Selector in Plesk is a straightforward process. Here’s...

How to Enable ionCube Loader using CloudLinux Selector in Plesk? (Video)

Enabling ionCube Loader on your server via CloudLinux Selector in Plesk is a simple process....

How to Enable the GD extension of PHP using CloudLinux Selector in Plesk? (Video)

Enabling the GD extension for PHP using CloudLinux Selector in Plesk is a straightforward...

How to Enable the Mailparse Extension of PHP Using CloudLinux Selector in Plesk? (Video)

To enable the Mailparse extension for PHP using CloudLinux Selector in Plesk. Follow these...

How to Enable or Disable PHP Extensions Using the CloudLinux Selector in Plesk? (Video)

Enabling or disabling PHP extensions via the CloudLinux Selector in Plesk is an easy and...