How to hide PHP errors on your website

How to hide PHP errors on your website

PHP error messages are useful while developing but shouldn't be shown to visitors on a live site, as they can reveal file paths and other details.

Option 1: MultiPHP INI Editor (recommended)

  1. In cPanel, open MultiPHP INI Editor in the Software section.
  2. Choose your domain.
  3. Set display_errors to Disabled and click Apply.

Option 2: .htaccess

Add this to the .htaccess file in your site's folder:

php_flag display_errors off

If this gives a 500 error, remove the line and use Option 1 instead.

Still need to see errors?

Errors are still written to your error log (see How to find error log files in cPanel), so you can turn them off for visitors and keep troubleshooting.

    • Related Articles

    • How to change PHP version in cPanel

      Log in to cPanel and open MultiPHP Manager in the Software section. Tick the domain(s) you want to change. Choose the PHP version from the drop-down menu on the right and click Apply. The change takes effect immediately and only for the domains you ...
    • PHP mail() vs SMTP: what's the difference?

      Websites can send email (contact forms, order confirmations, password resets) in two ways. PHP mail() The website hands the message straight to the server's mail system. It's simple, but the email isn't tied to a real mailbox and isn't authenticated, ...
    • How to connect to a MySQL database using PHP

      Before you start Create a database and a user in cPanel (see How to create a MySQL database in cPanel) and note: The database name and username – cPanel adds your account username as a prefix, e.g. cpuser_shop and cpuser_shopuser The user's password ...
    • My website is down: what should I do?

      1. Is it just you? Check with a service such as downforeveryoneorjustme.com, or try on your phone using mobile data instead of Wi-Fi. If it's down for everyone Check for an email from us about suspension or an unpaid invoice, and check your client ...
    • How to check PHP settings with phpinfo

      A phpinfo page shows the PHP version and settings your site is actually using. In cPanel File Manager, open public_html (or the folder for the domain you're checking). Click + File, name it something hard to guess such as info-82731.php, and create ...