Set ini display errors off

set ini display errors off

The error_reporting() function won't be effective if your display_errors directive in php.ini is set to "Off", regardless of level reporting you set. The display error statement is not what you actually want. You should change also the error_reporting value if you don't want to have the. To turn off or disable error reporting in PHP, set the value to zero. For example, use the code snippet: How to. set ini display errors off

Share: Set ini display errors off

Smart harddisk error

WARNING: These instructions were written for the EasyApache 3 PHP/Apache configuration. This older configuration efficiently handles direct modifications to the set ini display errors off file. However, if you are running EasyApache 4, then cPanel/WHM is designed to maintain the php.ini file(s). Any changes made directly to the php.ini file (while using EA3) may cause this functionality to not perform as expected. Be sure to check which version of EasyApache you are running, prior to making modifications as outlined in this article.

There are two methods for viewing PHP errors that occur while running your website. You can error no such partition display errors directly on your website (viewable from any web browser) or enable error logging to write the errors to a specified file (viewable inside a text file). This article will cover how to turn display_errors On and Off, adjust error reporting settings, configure error logging, and use the ini_set() function to help troubleshoot PHP errors with your website.

Editing the php.ini to Display Errors

While your site is live, the php.ini file should have display_errors disabled for security reasons. However, for the development environment, display_errors can be enabled for troubleshooting. Displaying errors should be disabled while the site is live, to protect sensitive information and not interfere with the format of your website pages. When display_errors is On, your site’s pages will display any PHP errors encountered when loading your website in a browser. This section will explain how to control error reporting and turn display_errorsOn and Off.

  1. Log into your cPanel.
  2. Go to the File Manager. Select the home directory for your website (by default: public_html) and click Go.
  3. Report all PHP errors

    Find the “Error handling and logging” section in the php.ini. In order to display or log errors, you need to enable error_reporting by removing the ( ; ) from in front to the line. You can disable error_reporting by adding a ( ; ) in front of the line. Refer to the code below: Error reporting disabled:

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

    Error reporting enabled to specifically report all errors, but not notices:

    ; - Show all errors, except for notices ; error_reporting = E_ALL & ~E_NOTICE ;
  4. Display PHP errors On

    Next you can set the display_errors variable to On or Off to either show the errors on your website or not. Look for the display_errors line in the php.ini file and set it to On to display errors or Off to turn not display errors. The code looks like the following:

    Display errors:

    display_errors = On

    Do not display errors:

    display_errors = Off

php.ini Error Reporting Settings

List of PHP Error reporting settings

PHP has a list of different error reporting settings within the php.ini file itself. For example, if you want to display only warnings you can change the error_reporting line to the following:

error_reporting = E_WARNING

The following table was created from the settings found in a standard php.ini file. Refer to the following table for the available options.

List of available options taken from php.ini
E_ALLAll errors and warnings
E_ERRORfatal run-time errors
E_WARNINGrun-time warnings (non-fatal errors)
E_PARSEcompile-time parse errors
E_DEPRECATEDnotices for the use of functions that will be retired in a future version
E_NOTICErun-time notices (these are warnings which often result from a bug in your code, but it’s possible that it was intentional (e.g., using an uninitialized variable and relying on the fact it’s automatically initialized to an empty string)
E_CORE_ERRORfatal errors that occur during PHP’s initial startup
E_CORE_WARNINGwarnings (non-fatal errors) that occur during PHP’s initial startup
E_COMPILE_ERRORfatal compile-time errors
E_COMPILE_WARNINGcompile-time warnings (non-fatal errors)
E_USER_ERRORuser-generated error message
E_USER_WARNINGuser-generated warning message
E_USER_NOTICEuser-generated notice error while saving model Error Logging On

By default errors are written to the error_log, set ini display errors off, which is set to /dev/null. This means, error logging won’t occur. When errors are turned on, set ini display errors off, errors will be stored in a file in the directory set ini display errors off error occurs in. For example, if you have a PHP file called index.php in a subdirectory like public_html/wordpress, if you have any PHP errors while running that file’s scripts, the error log will be stored in that folder (public_html/wordpress). You can specify (in the php.ini) which file to store all errors in.

Important!You must place the following code in the .htaccess to make the local php.ini work for the current directory where the .htaccess resides and all subdirectories within.<IfModule mod_suphp.c> suPHP_ConfigPath /home/USERNAME/public_html </IfModule>

The IfModule causes Apache to load the directive only if suPHP is used, so the site doesn’t break if switched to another PHP handler such as DSO.

For more information on suPHP and DSO please see our article on Choosing the best PHP handler.

  1. Log into your cPanel.
  2. Go to the File Manager, set ini display errors off. Select the public_html directory and click Go.
  3. Log PHP errors On

    You can set the following line of code to On to log errors or Off to turn error logging off.

    log_errors = On
  4. Path to PHP Error log

    Next you can save errors from any page in your files to a specific location by specifying the error_log. The example below uses a file named error_log This will place the error_log in the directory the error occurs in:

    ; Log errors to specified file. error_log = error_log

    This will write all errors to the error_log file inside the public_html directory, regardless of what directory the errors were encountered in:

    ; Log errors to specified file. error_log = /home/userna5/public_html/error_log

Using int_set() to Display Errors

In the case you want errors to not display site wide and you want to check errors on a single page, you can use the ini_set() function to have errors displayed on a particular page. The basic syntax from shows the function and its parameters is as follows:

string ini_set ( string $varnamestring $newvalue )

This can be placed at the top of your PHP page, with the error_reporting variable in it, to allow error checking for that particular page. Below are the steps for how to do this.

  1. Log into your cPanel.
  2. Go to the File Manager. Select the public_html directory and click Go.
  3. Navigate to the PHP file you want to check errors for. Open the file in the code editor.
  4. In the file, add the set ini display errors off at the top.ini_set('display_errors', '1');

    1 = On
    0 = Off

    Save the page.

    Now your PHP page only will display errors.

Maintain Your Log Files

Now that you have enabled error logging, be sure to maintain your log files. If you are getting errors regularly, be sure to remove the logs periodically. You may do so by just removing the file from within the File Manager or through any other method that 2015 error quicktime prefer to manage your files, set ini display errors off. A large log file can sometimes cause issues by possibly filling your disk space or if on shared hosting with unlimited disk space, begin to impact other customers on the server.


php.ini Error Settings

Error settings in php.ini tell PHP interpreter what kind of errors should be reported and where those should be reported. You may enable these settings in your development environment and disable few in your production environment since useful information error reports provide can also be sensitive information that outsiders shouldn’t see.


Default value of this setting is ‘On’. It tells PHP interpreter that if it finds a type of error mentioned in error_reporting setting then add it to the output of the script. This basically means to show the errors in web browser.


Default value of this setting is ‘Off’. This tells whether to display errors that occur in PHP’s startup sequence. PHP manual recommends turning this ‘On’ only in your development environment as an aid for debugging.


Default value of this setting is ‘Off’. This setting tells whether errors should be logged in web server’s error log file. When you finish your application and put it live, it’s a good practice that you turn ‘Off’ display_errors and turn ‘On’ log_errors in your production server’s php.ini file, set ini display errors off.

This prevents users seeing any sensitive information that can go with error reports and let you still see them via web server’s error log. But in development, you would rather like to see errors on the web browser and would set the settings other way around.


This setting tells what type of errors should be displayed and/or logged. There are constants that can be given as values to this setting and there is single constant (E_ALL) that represents all error types.

Default value of this setting will be like below.

error_reporting = E_ALL & ~E_NOTICE

Above it instructs to discard errors fall into notices category. For an example, if you used an undefined variable in an echo() statement, PHP generates a notice. This can be a useful feature in debugging.

Think that you defined a variable as $name but mistyped it in the echo() statement as $nmae then PHP interpreter would let you know it. So, make sure you enable notices in your development environment by using just E_ALL as below.

error_reporting = E_ALL
E_STRICTwas introduced in PHP 5.0.0 and till PHP 5.4.0, it was not included in E_ALL. So, if you are using a version in-between, have the error_reportingsetting as below in your development environment.

error_reporting = E_ALL ” characters in between the possible parameters. The “&” character is set ini display errors off “true for all”, while the “

Recently one of our readers asked how to turn off PHP errors in WordPress? PHP warnings and notices help developers debug issues with their code. However it looks extremely unprofessional when they are visible to all your website visitors. In this article, we will show you how to easily turn off PHP errors in WordPress.

How to turn off PHP errors in WordPress

Why and When You Should Turn Off PHP Errors in WordPress?

PHP errors that you can see on your WordPress site are usually warnings and notices. These are not like internal server error, syntax errors, or fatal errors, which stop your website from loading.

Notices and warnings are the kind of errors that do not stop WordPress from loading your website. See how WordPress actually works behind the scenes for more details.

PHP errors in WordPress admin area

The purpose of these errors are to help developers debug issues with their code. Plugin and theme developers need this information to check for compatibility and best practices.

However, if you are not developing a theme, plugin, or a custom website, then these errors should be hidden. Because if they appear on the front-end of your website to all your visitors, it looks extremely unprofessional, set ini display errors off.

WordPress warning errors on homepage

If you see an error like above on on your site, then you may want to inform the respective theme or plugin developer. They may release a fix that would make the error go away. Meanwhile, you can also turn these errors off.

Let’s take a look at how to easily turn off PHP errors, notices, and warnings in WordPress.

Turning off PHP Errors in WordPress

For this part, you will need to edit the wp-config.php file.

Inside your wp-config.php file, look for the following line:

define('WP_DEBUG', true);

It is also possible, set ini display errors off, that this line is already set to false. In that case, you’ll see the following code:

define('WP_DEBUG', false);

In either case, you need to replace this line with the following code:

ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_DISPLAY', false);

Don’t forget to save your changes and upload your wp-config.php file back to the server.

You can now visit your website set ini display errors off confirm that the PHP errors, notices, and warnings have disappeared from your website.

Turning on PHP Errors in WordPress

If you are working on a website on local server or staging area, then you may want to turn on error reporting. In that case you need to edit your wp-config.php file and replace the code you added earlier with the following code:

define('WP_DEBUG', true); define('WP_DEBUG_DISPLAY', set ini display errors off, true);

This code will allow WordPress to start displaying PHP errors, warnings, and notices again.

We hope this article helped you learn how to turn off php errors in WordPress. You may also want to see set ini display errors off list of the most common WordPress errors and how to fix them.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Related Videos

Setting display_errors variable in the php.ini for MAMP


Leave a Comment

Proudly Powered By WordPress.

Theme Kaira by .