Question

Ok , I work at a place where I'm not allowed to touch the php.ini file because the server serves so many websites ... However, I was told that I can display php errors through htaccess so I can debug my code because right now , my PHP screen comes blank and it's not helping .. how can I display php errors through my local htaccess file without having to access php.ini ?

Was it helpful?

Solution 2

You can use these commands to enable error reporting and set the error level using your .htaccess file.

php_flag display_errors on
php_value error_reporting <error level>

You can also define error reporting in some kind of php config file using error_reporting().

error_reporting(E_ALL);

OTHER TIPS

You should use:

php_flag display_errors on

in your .htaccess file

php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on

enable PHP error logging

php_flag log_errors on php_value error_log /httpdocs/domain name/PHP_errors.log

Using htaccess, you may specify a maximum size for your PHP errors. This controls the size of each logged error, not the overall file size. Here is the general syntax:

general directive for setting max error size

log_errors_max_len integer

Ref Link : http://perishablepress.com/advanced-php-error-handling-via-htaccess/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top