Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
litespeed_wiki:config:disable_php_override_htaccess [2019/05/13 12:44]
Jackson Zhang
litespeed_wiki:config:disable_php_override_htaccess [2019/05/14 20:19]
Lisa Clarke Copyediting
Line 1: Line 1:
-====== ​How to disable ​PHP override in .htaccess with LSWS? ======+====== ​Disable ​PHP Override ​======
  
-''​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 [[https://​support.plesk.com/​hc/​en-us/​articles/​213409529-Website-hosted-in-Plesk-does-not-work-Invalid-command-php-flag-or-php-value-|a plesk document]] for details).+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 [[https://​support.plesk.com/​hc/​en-us/​articles/​213409529-Website-hosted-in-Plesk-does-not-work-Invalid-command-php-flag-or-php-value-|Plesk'​s documentation]] for details). 
 + 
 +You could see any one of the following errors:
  
   500 internal server error   500 internal server error
- 
-or: 
  
   503 Invalid command '​php_flag',​ perhaps misspelled or defined by a module not included in the server configuration.   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:   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_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   /​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   /​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. ​   /​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 allThis give LSWS more error tolerant than Apache.+LiteSpeed Web Server uses lsphp, which supports ​''​php_value''​ and ''​php_flag''​ usage in .htaccess. You can use these and LSWS will not return ​500 error. LSWS is more tolerant than Apache ​of these PHP overrides.
  
-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.+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:+For example, on Plesk, create a file named ''​DisablePhpOverrideLiteSpeed.conf'' ​in the following directorydepending upon your system:
  
-For CentOS, the /​etc/​httpd/​conf.d/ ​directory +  * CentOS: ''​/​etc/​httpd/​conf.d/​''​ 
-For Debian, the /​etc/​apache2/​conf.d/ ​directory +  ​* ​Debian: ''​/​etc/​apache2/​conf.d/​''​ 
-For Ubuntu, the /​etc/​apache2/​conf-enabled ​directory +  ​* ​Ubuntu: ''​/​etc/​apache2/​conf-enabled''​ 
-This DisablePhpOverrideLiteSpeed.conf file should contain the following:+ 
 +This ''​DisablePhpOverrideLiteSpeed.conf'' ​file should contain the following:
  
   <​IfModule LiteSpeed>​   <​IfModule LiteSpeed>​
     DisablePhpOverride htaccess     DisablePhpOverride htaccess
   </​IfModule>​   </​IfModule>​
- 
- 
  • Admin
  • Last modified: 2019/05/14 20:19
  • by Lisa Clarke