Issue
DirectAdmin is overwritting the php version selected by PHP-Selector
Environment
CloudLinux OS 6(h)/7(h)/8
DirectAdmin
Solution
The most recent versions of DirectAdmin control panels allow you to have several versions of PHP and every user on such server can change a PHP version per domain by going to their DirectAdmin account > Modify some domain and select any of PHP versions there.
However, this may become a problem if you want to use PHP Selector provided by CloudLinux on DirectAdmin server all because DirectAdmin will overwrite PHP version with AddHandler directive set in domain's virtualhost. For example:
To prevent DirectAdmin Selector from interfering into CloudLinux PHP Selector, you need to have only one PHP version built on the server with custombuild.
# cd /usr/local/directadmin/custombuild
# ./build set php1_release 7.4 # select the default DA version
# ./build set php2_release no # set the rest to 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
The above sequence of commands will install the DirectAdmin-provided PHP version of your choosing as php1_release, it will also disable all other DirectAdmin PHP versions that you might have installed.
Note that these commands do not operate alt-phpXX packages, the PHP versions installed/uninstalled here are managed by DirectAdmin.
All users that had any of the above versions set for their websites in DirectAdmin Selector will now be using the php1_release version which will enable PHP Selector from CloudLinux.
Make sure that you use one of the supported PHP handlers (suphp, fastcgi, mod_lsapi). PHP-FPM is not compatible with PHP Selector.
Comments
2 comments
still same after done
Were there any errors during the compilation? Anyway, please create a support ticket so we can check the issue in place.
Please sign in to leave a comment.