This is an old revision of the document!
Enable per directory PHP in LSWS native mode
This wiki is to explain how to set per directory PHP and it is only applicable for LSWs native mode and doesn't fit when you use control panel or apache configuration mode.
Set different PHP per virtual host
When you use LSWS native without apache configuration, Normally you can define PHP version through PHP handler for each virtual host. To do so, you normally define multi-server level PHPs external apps and assign different handler at the server level and virtual host level. If no virtual host level hander defined, the virtual host will heritage server level PHP configuration.
For example, we set external apps at server level:lsphp54, lsphp55, lsphp56, lsphp70, lsphp71, lsphp72.
The lsphp70 external app looks like the following, the rest are similar to it:
At the server level, we defined lsphp71 as default handler to handle .php and .php5.
The virtual host will hesitate the above server default handler lsphp71 unless overridden. The following is an example to override the php version to lsphp56 for that virtual host.
Set different PHP per directory within one virtual host
The above wiki explains how to set different PHP for each virtual host, but if you would like to set different PHP within a virtual host, most likely per-directory basis, in addition to the above, you will set more handler in server level “script handler”, then use .htaccess to change the php version
Add handlers to server level: in addition to the exiting .php and .php5 suffix, add .php54, .php55, .php56, .php70, .php71, .php71, .php72
On virtual host DEFAULT, we have changed it to use lsphp56.
Under the sub directory /sub1/, it will use lsphp56 as well. To change it to use different version lsphp72, vi sub1/.htaccess
ForceType application/x-httpd-php72
You can also change it to use another PHP version by changing the last two digits. such as:
ForceType application/x-httpd-php54
or
ForceType application/x-httpd-php55
or
ForceType application/x-httpd-php56
or
ForceType application/x-httpd-php70
or
ForceType application/x-httpd-php71