Enabling error display in php only through htaccess

I am testing a website on the Internet.

Errors are not currently displayed (but I know they exist).

I only have access to the .htaccess file.

How to make all errors to display using .htaccess file

EDIT

I added these lines to my .htaccess :

 php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on 

and pages NOW

Internal Server Error

+104
php error-handling .htaccess
May 25 '11 at 16:50
source share
6 answers

.htaccess:

 php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on php_flag log_errors on php_value error_log /home/path/public_html/domain/PHP_errors.log 
+176
May 25 '11 at 16:54
source share
 php_flag display_errors on 

To enable the actual display of errors.

To set the types of errors displayed, you need to use:

 php_value error_reporting <integer> 

Combined with integer values ​​from this page: http://php.net/manual/en/errorfunc.constants.php

Please note that if you use -1 for your integer, it will display all errors and be a proof in the future when adding new types of errors.

+39
May 25 '11 at 16:57
source share

I would like to add more detailed information to the existing answer:

 # PHP error handling for development servers php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on php_flag log_errors on php_flag ignore_repeated_errors off php_flag ignore_repeated_source off php_flag report_memleaks on php_flag track_errors on php_value docref_root 0 php_value docref_ext 0 php_value error_log /full/path/to/file/php_errors.log php_value error_reporting -1 php_value log_errors_max_len 0 

Grant permission 777 or 755 to the log file, and then add the code

 <Files php_errors.log> Order allow,deny Deny from all Satisfy All </Files> 

at the end of .htaccess. This will protect your log file. These options are suitable for the development server. For a production server, you should not cause errors to the end user. Therefore, change the display flags to.

For more information, follow this link: Advanced PHP error handling through htaccess

+15
Jan 08 '16 at 9:56 on
source share

If you want to see only fatal runtime errors:

 php_value display_errors on php_value error_reporting 4 
+1
Aug 23 '17 at 23:28
source share

it works for me refrance

 # PHP error handling for production servers # disable display of startup errors php_flag display_startup_errors off # disable display of all other errors php_flag display_errors off # disable html markup of errors php_flag html_errors off # enable logging of errors php_flag log_errors on # disable ignoring of repeat errors php_flag ignore_repeated_errors off # disable ignoring of unique source errors php_flag ignore_repeated_source off # enable logging of php memory leaks php_flag report_memleaks on # preserve most recent error via php_errormsg php_flag track_errors on # disable formatting of error reference links php_value docref_root 0 # disable formatting of error reference links php_value docref_ext 0 # specify path to php error log php_value error_log /home/path/public_html/domain/PHP_errors.log # specify recording of all php errors # [see footnote 3] # php_value error_reporting 999999999 php_value error_reporting -1 # disable max error string length php_value log_errors_max_len 0 # protect error log by preventing public access <Files PHP_errors.log> Order allow,deny Deny from all Satisfy All </Files> 
0
Aug 15 '19 at 14:11
source share

If you're talking about PHP errors, just add this at the top of your script:

 error_reporting(E_ALL); 

EDIT: If you mean that you cannot edit your script, you will need to use php_flag inside your htaccess file. See http://perishablepress.com/press/2007/12/17/how-to-enable-php-error-logging-via-htaccess/

-eleven
May 25 '11 at 16:52
source share



All Articles