0

I have following .htaccess file code after installing wordpress:

#+PHPVersion
#="php73"
AddHandler x-httpd-php73 .php
#-PHPVersion

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Now While I am trying to enable the display of php error by adding htaccess rule in between and by the following line:

php_value display_errors 1

The Website is showing: enter image description here

As soon as I remove that line of code, the site is ok. As far I know, that line of code is necessary for showing/displaying any error of php code while visiting one page.

How to enable that in the above .htaccess code?

2 Answers 2

2

According me, your code is write but you are getting error because you might be possible using php-fpm not mod_php

I am trying here give you the both solution

Below will be for php-fpm

Step 1 : add .user.ini on root directory where you can find wp-config.php

Step 2 : add below code in the above file

 display_errors = On
 display_startup_errors = On
 html_errors = 1
 error_reporting = -1

Now if you are using mod_php then add below code in .htacess

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 /directory_path/errors.log
php_value error_reporting -1
php_value log_errors_max_len 0

Adding phpinfo(); will help you to find that which (mod_php or php-fpm) has been under use.

Sign up to request clarification or add additional context in comments.

3 Comments

It is showing php-fpm Active under cgi-fcgi in PHP INFO
User the first option of .usr.ini if that doesn’t work add php.ini on the same place and add same code
Although that doesn't work for me, but I have found to display error from my hosting panel dashboard. But I think your info is very useful and can help somebody else. So I have accepted your answer and upvoted. Thankyou very much.
2

In wordpress you can enable errors in wp-config.php:

define('WP_DEBUG', true);

2 Comments

I have added but it is not showing the error. As for example, I have added a wrong url in require in php but it is not showing that the file is not exist.
Did you change the default false to true? I just tried it with your example and works for me: Warning: require(header.phpp): failed to open stream: No such file or directory in /Users/....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.