1

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 ?

Stack Overflow
  • 237
  • 2
  • 5
  • 14

3 Answers3

1

You should use:

php_flag display_errors on

in your .htaccess file

Cristian Bitoi
  • 1,492
  • 1
  • 10
  • 13
0

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);
mat
  • 181
  • 1
  • 3
0

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/

Prasanth
  • 46
  • 5