How to enable PHP error reporting via .htaccess File

Printer-friendly versionPrinter-friendly versionSend to friendSend to friendPDF versionPDF version

Sometimes it's useful to unhide errors PHP script generated for debugging. But on many servers, php.ini's configuration has disabled error displaying for security purposes. This quick tutorial explains how to display PHP errors by modifying the .htaccess file.

apache server

You can enable error reporting under Apache, even if you don't have administrator rights and can't access main httpd.conf file.

To enable error reporting in PHP, use your favorite text editor and add the following line to the .htaccess file located in the directory where your .php files reside:

php_flag display_errors on

This will override Apache's default settings to display PHP errors, unless your Apache configuration doesn't allow this modification.

Listed in

User comments on this frequently asked question:

Wow, this one was quick and easy. Your FAQ site has been useful, as always.

yes, it worked, definitely a good tip. thnx

You can also enable displaying of error messages in php.ini file.