Miscellaneouss

How To Enable Displaying PHP Errors On Site

enable-displaying-php-error-on-site-801x430
mm
Written by Santosh Prasad

Displaying the PHP error on websites is important and helpful for solving different problems. For example:

-If blank page displayed instead of content on your site or

-If you are getting 500 error message on the website page.

Blank page is mostly caused by some PHP error in the code. If you have enabled the error reporting then it is very easy to find the error and solve the problem.

You can set PHP error reporting in php.ini file. You will need to set the following lines:

error_reporting  =  E_ALL
display_errors = On

If you have installed your server e.g. with help of XAMPP, see the documentation where to find the php.ini file. Don’t forget to stop Apache server before doing modifications and start it again after saving these modifications.

You can also modify .htaccess file on the server if you don’t have access to php.ini file. Add the below code in the .htaccess file:

# Displaying PHP errors
php_flag display_errors on
php_value error_reporting 6143

If you can’t access the .htaccess file or your modifications in the file have no effects, try to ask your webhosting provider for enabling error reporting or try to see your error log file.

After you will get the information about the problem and you will solve this problem, you should disable php error reporting again, so no error will be displayed for the public (because of security reasons).

Thanks:)

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment