skip to Main Content

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


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

    define('WP_DEBUG', true);
    
    Login or Signup to reply.
  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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search