Error from PHP log: Invalid command 'php_flag'

Post Reply
unitydev
Posts: 2
Joined: Mon Sep 06, 2021 1:01 pm
Error from PHP log: Invalid command 'php_flag'

Post by unitydev »

I get this error:

Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration

It brings 500 server error when I visit URL

It is caused by my htaccess which Was working until I installed myvesta. What should I edit in PHP.ini to make this work ( I don't want to mess things up)

Htaccess code:

Code: Select all

ErrorDocument 404 /404/index.php
<Files "settings.json">  
  Order Allow,Deny
  Deny from all
</Files>
php_flag  display_errors 1
php_flag  display_startup_errors 1
php_value  error_reporting 2047

User avatar
dpeca
Site Admin
Posts: 550
Joined: Fri Jun 19, 2020 9:59 am
Your location: Serbia, Niš and Belgrade
First name and last name: Predrag Damnjanović
Re: Error from PHP log: Invalid command 'php_flag'

Post by dpeca »

You can't use php_ flags in .htaccess since PHP is not in Apache but in PHP-FPM.
You can just remove those lines from .htaccess and set those values to PHP-FPM pool.d conf files - viewtopic.php?f=18&t=54

So, in /etc/php/7.x/fpm/pool.d/your-domain.com.conf you can add:

Code: Select all

php_admin_flag[display_errors] = 1
php_admin_flag[display_errors] = 1
php_admin_value[error_reporting] = 2047
After you make the changes, you should restart php-fpm (do it in SSH, as root):

Code: Select all

sudo systemctl restart php7.x-fpm
(where 7.x is 7.3 for example)


Post Reply