Disable PHP Override
You can disable the PHP override in .htaccess
with LiteSpeed Web Server.
php_value
and php_flag
can be used in Apache configuration or .htaccess
to override php.ini
settings. However, they are only supported by Apache's mod_php
handler, which is deprecated in most of the control panel systems, having been replaced by php-fpm, fastcgi or lsphp. As a result, if you place php_value
or php_flag
in .htaccess, Apache should return an error. (You can check Plesk's documentation for details).
You could see any one of the following errors:
500 internal server error
503 Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration. The following error can be found in the domain error log in Domains > example.com > Logs: /var/www/vhosts/example.com/httpdocs/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
/var/www/vhosts/example.com/httpdocs/.htaccess: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration
/var/www/vhosts/example.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters
/var/www/vhosts/example.com/public_html/.htaccess: Invalid command 'suPHP_ConfigPath', perhaps misspelled or defined by a module not included in the server configuration.
LiteSpeed Web Server uses lsphp, which supports php_value
and php_flag
usage in .htaccess. You can use these and LSWS will not return a 500 error. LSWS is more tolerant than Apache of these PHP overrides.
In some cases, you may want to disable such PHP overrides in .htaccess for LiteSpeed as well. There is a dedicated Apache directive DisablePhpOverride htaccess
, which can be used at the server level httpd.conf
to achieve this.
For example, on Plesk, create a file named DisablePhpOverrideLiteSpeed.conf
in the following directory, depending upon your system:
- CentOS:
/etc/httpd/conf.d/
- Debian:
/etc/apache2/conf.d/
- Ubuntu:
/etc/apache2/conf-enabled
This DisablePhpOverrideLiteSpeed.conf
file should contain the following:
<IfModule LiteSpeed> DisablePhpOverride htaccess </IfModule>