This is an old revision of the document!
====== How to disable PHP override in .htaccess with LSWS?
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 mod_php handler, which is almost deprecated in most of the control panel systems and is replaced by php-fpm, fastcgi or lsphp. Hence if you place php_value
or php_flag
in .htaccess, Apache should return 500 error (you can check a plesk document for details).
500 internal server error
or:
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
or:
/var/www/vhosts/example.com/httpdocs/.htaccess: Invalid command 'php_flag', perhaps misspelled or defined by a module not included in the server configuration
or:
/var/www/vhosts/example.com/httpdocs/.htaccess: RewriteRule: bad flag delimiters
or:
/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.
While LSWS will use lsphp, which is actually supported php_value
and php_flag
usage in .htaccess and LSWS won't return 500 at all. This give LSWS more error tolerant than Apache.
In some cases, you may want to disable such php override in .htaccess for LiteSpeed as well. There is a dedicate Apache directive DisablePhpOverride htaccess
can be used at server level httpd.conf to achieve this.
For example, place the following to the global include file such as pre_main_global.conf
for cpanel:
<IfModule LiteSpeed> DisablePhpOverride htaccess </IfModule>