Different PHP version in folders

Hedloff

Well-Known Member
#1
Hello,

I'm very confused about this and how it should be setup actually. You have a howto here. I have not done this on the server.
On new servers we get LSAPI App for all PHP versions as shown in the attachment.

See also attachment for lsphp5 and lsphp70.
Those are working fine, but should also "Command" in lsphp70 use /usr/local/bin/lsphp ?

Because in lsphp56 I have tried another path in "Command": /opt/cpanel/ea-php56/root/usr/bin/lsphp

So when customer chooses PHP 7.0 from Cloudlinux it changes PHP version as it should.
And when customer adds a line in their .htaccess file in a seperate folder:
AddHandler application/x-httpd-php56 .php

This is because customer wants .php files loaded as PHP 5.6 in these folders execept on the main domain. With that setup it's working fine.

But as soon as I change "Command" for lsphp56 in External App to: /usr/local/bin/lsphp then it stops working.

So my question is:
Should all other External App other than lsphp5 have /opt/cpanel/ea-phpXX/root/usr/bin/lsphp in order to get different PHP version per folder?
 

Attachments

Jon K

Administrator
Staff member
#2
Hello Hedloff,

/usr/local/bin/lsphp is a universal lsphp binary to be used system wide. It is more recommended in this case to use either the cPanel or CloudLinux PHP paths.

cPanel
/opt/cpanel/ea-phpXX/root/usr/bin/lsphp

CloudLinux
/opt/alt/phpXX/usr/bin/lsphp

You should point the commands to the respective versions php.

So for example the command for cPanel and PHP 70
Command: /opt/cpanel/ea-php70/root/usr/bin/lsphp

You will probably want to follow the wiki guide you linked and just change the paths to the ones you want.

- J
 
Last edited by a moderator:

Hedloff

Well-Known Member
#3
Ok, thanks for your reply.
But what about lsphp5, what version is that? Cloudlinux wiki tells us to use /usr/local/bin/lsphp on that one?
And what do you recommend to use, CL or cPanels path?

I see old servers with EA3 only have lsphp5, and not all the others. Will they be created when migrating to EA4 or should we set them up manually?
 

Hedloff

Well-Known Member
#5
Thanks for information. Maybee add EA3 somewhere in the howto?

About EA4 we do not use MultiPHP from cPanel and alot of hosts don't use it yet and will not either. We stick with CloudLinux PHP Selector.
But I have used path to multiphp in external app and found that it is the best solution for customers to have their own php version in different directories.

But from this howto, you state:
"When choosing a PHP version for a domain in cPanel Admin Home → Software → Multi-PHP Manager, LiteSpeed will now correctly use the selected version. PHP handlers should be “CGI” (can not be “DSO”) to able to choose different versions. Otherwise, LiteSpeed may only return the default version instead of the version you have selected from Multi-PHP manager."

Why cannot suphp be choosen?
 

Pong

Administrator
Staff member
#6
wiki updated. Thanks.

Is there any particular reason you don't use EA4 MultiPHP?

For EA4 PHP handler, CGI is the default handler. SuPHP also works.
 

Hedloff

Well-Known Member
#7
Yes, we don't use MultiPHP since they do not provide ability to choose extensions as PHP Selector from CL does.
And others feel the same as shown in this thread:
https://www.cloudlinux.com/forum/forum11/topic1283

In my mind CGI handler is not default in cPanel. It is also not secure and do have a large CPU footprint?
So why should we use CGI instead of suPHP as we always have used?
 

NiteWave

Administrator
#8
I think CGI/php-fpm/DSO/suPHP are various technology terms regarding php process management.
in litespeed, only one method -- lsphp. and we believe it's with best performance and security.
it can run suExec/non-suExec mode. and in suExec mode, there are 3 sub mode: Worker, Daemon,ProcessGroup.
 
#9
Hello @Hedloff,

You can find cPanel documentation on PHP handlers with EasyApache 4 at:

https://documentation.cpanel.net/display/EA4/PHP+Handlers

CGI is the default PHP Handler offered with cPanel, and you are correct that DSO or suPHP is recommended for increased security:

While CGI meets the needs of most users, for better security handling we recommend that you use DSO and suPHP instead.
However, as I understand, LiteSpeed addresses this concern with suEXEC Daemon mode:

https://www.litespeedtech.com/products/litespeed-sapi/php/suexec-daemon-mode

Note that I also encourage you to vote and add feedback to the following feature request if you'd like to see better integration with PHP Selector and MultiPHP Manager:

https://features.cpanel.net/topic/improve-ea4-multiphps-integration-with-cloudlinuxs-php-selector

Let me know if you have any additional questions I can help answer.

Thank you.
 
Top