Cloudlinux + Litespeed + Directadmin -> Different php versions per account

ViAdCk

Verified User
Joined
Feb 14, 2005
Messages
300
Hello,

Has anyone running cloudlinux+litespeed+directadmin been able to offer different php versions for domains configured in the same hosting account?

Litespeed has a guide but it's only for native: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:per-directory-php

And cloudlinux has a guide but it's focused on apache and cpanel: https://www.cloudlinux.com/cloudlin...-php-versions-per-directories-using-mod-lsapi

Hay anyone been able to get this configured on directadmin?

Thanks in advance!
 
If you select lsphp as PHP mode, CloudLinux PHP selector should work fine out-of-the-box.
 
Hi Martynas,

Yes, cloudlinux php selector works just fine but with only 1 php version per account. Some users have various domains in their hosting accounts and would like to assign a different php version for each domain.

Any idea how this can be configured on cloudlinux + directadmin + litespeed?

Regards
 
old post but I had this issue, but solved with this :

add this line as you need on /etc/container/php.handler

application/x-lsphp52 /opt/alt/php52/usr/bin/lsphp
application/x-lsphp53 /opt/alt/php53/usr/bin/lsphp
application/x-lsphp54 /opt/alt/php54/usr/bin/lsphp
application/x-lsphp55 /opt/alt/php55/usr/bin/lsphp
application/x-lsphp56 /opt/alt/php56/usr/bin/lsphp
application/x-lsphp70 /opt/alt/php70/usr/bin/lsphp
application/x-lsphp71 /opt/alt/php71/usr/bin/lsphp
application/x-lsphp72 /opt/alt/php72/usr/bin/lsphp
application/x-lsphp73 /opt/alt/php73/usr/bin/lsphp
application/x-lsphp74 /opt/alt/php74/usr/bin/lsphp


create a file /etc/cl.selector/symlinks.rules add the following content: php.d.location = selector

And run the command to apply changes:

/usr/bin/selectorctl --apply-symlinks-rules


The most important thing is to check back in the litespeed panel for the External App and Script Handler for all php versions.

I didn't know it wasn't generated automatically when I installed litespeed on cloudlinux + php selector

the last use .htaccess to handle php version for example using 7.1 put inside subdomain folder/folder

<FilesMatch "\.(php4|php5|php3|php2|php|phtml)$">
SetHandler application/x-lsphp71
</FilesMatch>

i hope this help :)
 
old post but I had this issue, but solved with this :

add this line as you need on /etc/container/php.handler

application/x-lsphp52 /opt/alt/php52/usr/bin/lsphp
application/x-lsphp53 /opt/alt/php53/usr/bin/lsphp
application/x-lsphp54 /opt/alt/php54/usr/bin/lsphp
application/x-lsphp55 /opt/alt/php55/usr/bin/lsphp
application/x-lsphp56 /opt/alt/php56/usr/bin/lsphp
application/x-lsphp70 /opt/alt/php70/usr/bin/lsphp
application/x-lsphp71 /opt/alt/php71/usr/bin/lsphp
application/x-lsphp72 /opt/alt/php72/usr/bin/lsphp
application/x-lsphp73 /opt/alt/php73/usr/bin/lsphp
application/x-lsphp74 /opt/alt/php74/usr/bin/lsphp


create a file /etc/cl.selector/symlinks.rules add the following content: php.d.location = selector

And run the command to apply changes:

/usr/bin/selectorctl --apply-symlinks-rules


The most important thing is to check back in the litespeed panel for the External App and Script Handler for all php versions.

I didn't know it wasn't generated automatically when I installed litespeed on cloudlinux + php selector

the last use .htaccess to handle php version for example using 7.1 put inside subdomain folder/folder



i hope this help :)
we use such selector too, on any servers, with cloudlinux - as you described, without cloudlinux - php installed by YUM from REMI :)
 
today added php 8.1, and if PHP files uploaded, but not executed:
1. add to /etc/container/php.handler
application/x-lsphp81 /opt/alt/php81/usr/bin/lsphp
2. from DA -> Cloudlinux LVE manager -> Options -> CageFS
near CageFS Skeleton press button: Update
3. from ssh console:
cagefsctl --force-update
 
The most important thing is to check back in the litespeed panel for the External App and Script Handler for all php versions.
How do we "check back" and add it properly so that it functions as expected?
 
How do we "check back" and add it properly so that it functions as expected?
I think I figured it out, added the following in /usr/local/lsws/conf/httpd_config.xml just before the ending XML tag:

<extProcessorList> <extProcessor> <type>lsapi</type> <name>lsphp80</name> <address>uds://tmp/lshttpd/lsphp80.sock</address> <maxConns>160</maxConns> <env>PHP_LSAPI_MAX_REQUESTS=160</env> <env>PHP_LSAPI_CHILDREN=80</env> <initTimeout>60</initTimeout> <retryTimeout>0</retryTimeout> <persistConn>1</persistConn> <respBuffer>0</respBuffer> <autoStart>3</autoStart> <path>/opt/alt/php80/usr/bin/lsphp</path> <backlog>100</backlog> <instances>1</instances> <extMaxIdleTime>70</extMaxIdleTime> <priority>0</priority> <memSoftLimit>2047M</memSoftLimit> <memHardLimit>2047M</memHardLimit> <procSoftLimit>400</procSoftLimit> <procHardLimit>500</procHardLimit> </extProcessor> </extProcessorList>

Note: Must validate your XML using an XML validator before restarting the server to avoid missing something and risking unnecessary downtime.

For other PHP versions (other than php8) simply replicate the config with different PHP directories/binaries, change all occurrences of lsphp80 to lsphp81 and path from /opt/alt/php80/usr/bin/lsphp to /opt/alt/php81/usr/bin/lsphp.
 
Last edited:
Don't need above code. Go to Litespeed Web Admin Console, enable Detached Mod and control panel is Directadmin.
When you select php in Domain setup, it will change php for domain. php in litespeed is default version
1680342122664.png
 
When you select php in Domain setup, it will change php for domain
I replied the solution for CloudLinux HardenedPHP (ALT-PHP), DirectAdmin's PHP Selector does not use CloudLinux's PHP Selector / Extensions afaik.
 
Back
Top