DirectAdmin PHP Selector and CloudLinux PHP Selector

Walther

Verified User
Joined
Oct 11, 2020
Messages
10
Using DA+CL, the user has both PHP selectors available (DA native + CL), but the one from CloudLinux is better.
To use CL PHP Selector, the user has to set the default PHP version in DA PHP Selector, and then modify/customize his PHP environment using the CL Tool.

But as the user opens his DA interface, in the home page he can find the DA "change PHP" function, and this is misleading (lot of users changed it, then customized PHP using CL tool, and then opened a ticket "why my customization is not effective?!!"

So, the question is: does exist any way to modify evolution skin, in order to remove that "change PHP" link from the home page, or to redirect it to /user/plugins/phpselector ?

Or any other trick to make this easier and more error-proof for the user?
 
From CloudLinux side you can allow use "native" php (installed by DA), or deny to use it. Also DA selector allows You to use per-domain selection, while CloudLinux selector changes PHP version for whole account.
-----
We are using own selector that allows to set any CloudLinux php version for any domain separately, and native PHP denied.
 
@Zhenyapan can you publish the selector you build? We are in the same position, where we are planning to build/change the DA selector to use the php selector in CageFS. It’s not hard, because it only needs to edit .htaccess per domain and add the a handler for the selected php version. But if you have created this selector already, it would be great if we (community) could use it.
 
@bbytes it's not my own, it was found in internet space near 2012 and rewritten for our purposes, but I can give it, when I will be near servers at friday night or saturday.
 
Sharing extra functionality is always highly appreciated!

Just to clarify the point being made in the original post by @Walther, CL recommends setting only 1 PHP version in DA to prevent a conflict between the two: https://cloudlinux.zendesk.com/hc/e...460-PHP-Selector-Integration-with-DirectAdmin
forum allows zip only, so I compressed tar.gz by zip -_-
extract it at /usr/local/directadmin/plugins/
and at admin level: select which versions installed and which one default (when user serlect this version - it will not add handler to domain's htaccess)
 

Attachments

  • phpvs.zip
    6.5 KB · Views: 105
also at /etc/container/php.handler/
you must have all installed versions list handlers, like:
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
application/x-lsphp80 /opt/alt/php80/usr/bin/lsphp
 
@Zhenyapan thank you very much. We have a look at it and make the changes if necessary. This is great that we can help each other.
 
after installing the plugin, make sure /usr/local/directadmin/plugins/phpvs/data has complete write permissions.

Just an addon post for all that only want to use CL alt-php for your customers and remove any conflict with DA.
# install only one native php version with Directadmin. If you have several, remove all by setting php_release to no.
./build set php2_release no
./build set php3_release no
./build set php4_release no

./build php n
./build rewrite_confs

cagefsctl --force-update
cagefsctl --remount-all
cagefsctl --setup-cl-selector
———————

In order to use the CL php modules selector with this plugin, we need to add another config.
Create a file /etc/cl.selector/symlinks.rules (read-only for regular users)
Content: php.d.location = selector
Save the file.

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

now customers can select their php modules and select php options in ”Select PHP version” for their favorite php version.
———————

Now we only have to put a designer on it, to make the plugin look a bit nicer. ;-)
 
Last edited:
Hello,

Thank you for this contribution, found editing the .htaccess for my clients troublesome, and most of them are not capable of editing it themselves.

I did make some changes to your plugin.
First off, I edit /home/username/domains/domain.be/.htaccess and not /public_html/.htaccess
The default .htaccess for an application is kept like it is, and users are less prone of making the wrong edits.

Secondly, I removed the custom default option. I added a default option for the user (empty .htaccess) which uses the server default.
This way if my server default is 7.4, the user is still able to select it to prevent further problems if I change my server version to a newer version.

I also removed the disabled php versions in the client screen. I haven't tested how this reacts to a php version in the .htaccess that is not enabled by the admin.

And I changed "PHP Version Selector" to "Per Domain PHP Version selector".This way it's less confusing with the default "Select PHP version" from CloudLinux.

In the future I might try to read out /etc/container/php.handler and dynamicly fill in the tables.
Andin the new Evolution skin the plugin shows an empty page.

Bumped the version to v1.1 and added Authors to the plugin configuration file.

regards,
Stijn
 

Attachments

  • phpvs-1.1.tar.gz.zip
    6.3 KB · Views: 125
Back
Top