DirectAdmin PHP version change (target: different settings for each domain/subdomain) while using plugins/phpselector

wdc

Verified User
Joined
Dec 8, 2013
Messages
75
I would like to ask if one of the DirectAdmin staff can spend time reading this and spotting the issue/bug and report it for fixing.

TLDR/Outcome - How to safely handle PHP version in DirectAdmin

Change PHP version for main domain and then for subdomains. With delay of maybe 30 seconds, test that all phpinfo pages of all sites are reporting correct versions and all sites are working. If not working (empty page/error 500):
- try to test other PHP version for that sub/domain and subsequently change main DA version (/evo/user/domains/domain/yout.tld) to same number.
(For me the error 500 remained when main domain version was lower than the one set for error 500 subdomain (other subddomains without errors could have lower version).
- Now check your main domain website if it is working (you may have modified its PHP version), if the version is wrong, see if DirectAdmin has /evo/user/plugins/phpselector and select proper version there and it may override your main domain PHP setting)


Long version:

directadmin 1.668

Added .php file with content <?php phpinfo(); ?> to a domain and subdomains folders and visited the URLs of that .php. All has same old PHP version 5.6.40.

So how to customize versions?

Under domain management, I have clicked a link to select PHP version and set 7.4. Result: version of the main domain and two subdomains changes (with a delay like 20 seconds?), but one remains at old PHP version.

When I change it to old PHP version 5.6.40, nothing changes. Then I have set the version which has been pre-selected before I have started with this process - v8.2, surprisingly, all the sites PHP version changed to 5.6.40 (i think that this is thanks to /evo/user/plugins/phpselector?path=index.html#/extensions overrides).

When I go to a subdomains section, I can see all except one subdomain has 8.2 (though phpinfo shows 5.6.40), the one that differs has set 5.6 and it is the one which in previous step failed to change to 7.4.

When in subdomain section I change one of the subdomains PHP version:

from 8.2 to 8.1, phpinfo shows 5.6.40 and after several seconds 8.1

from 8.1 to 8.2, phpinfo shows 8.1 for 30 seconds around and then 5.6.40 (like if there is some weird redirect from 8.2 to 5.6) - maybe because default DirectAdmin main domains PHP is 8.2 and PHP selector: /evo/user/plugins/phpselector?path=index.html#/extensions overrides it to 5.6 (yes it is set to 5.6).

it seems quite a mess how it works.

When I change main domain PHP (again in domains settings) from 8.2 to 7.4, it nicely changes only main domain PHP properly to 7.4, subdomains retains its own versions. Good.

Under such circumstances, when I change subdomain to 7.4, it now "redirects to/uses" wrongly the version 5.6.40. It looks like a bug caused by /evo/user/plugins/phpselector?path=index.html#/extensions which is always redirecting DirectAdmin main domain/account PHP version no matter where it is set (on domain / on subdomain), causing this conflict? Can you report this please to a developer?

Weird is that when I have set all subdomains to 5.6 and DA main domain to 7.4, the subdomains are using 7.4, not 5.6 (confirming using phpinfo). (/evo/user/plugins/phpselector is set to 5.6)

When I switch DA main domain from 7.4 to 8.1, subdomains PHP version (returned by phpinfo) gets fixed to 5.6 (set in subdomains section). Interestingly, main domain shows PHP 8.1, despite /evo/user/plugins/phpselector is set to 5.6.

Then I try to switch inside that phpselector plugin from 5.6 to other versions and none of those I have tried (5.4, 7.4, 8.4) changes version for main domain. So I have set "exotic" 4.4 so it reminds me not to use this PHP selector plugin (but it was very useful in the past to enable various php extensions, enable logging and others).

When messing with PHP versions, there may be website error 500 - empty page. Maybe caused by wrong PHP version combination (main vs subdomain) or a .htaccess file content (when I have emptied it, it did not help). Also it may be just temporary, as I have mentioned, PHP change did not propagate immediately, but took maybe half a minute? Or it may be some unhandled exception of a PHP version change.

For example error 500 remained no matter which subdomain version I have set. But disappeared when I have raised main domain PHP version to 8.2. Main domain site phpinfo remains to show 5.6 instead of 8.2 (likely thanks to /evo/user/plugins/phpselector where is set 5.6).

It is as if there is a weird dependency chain: to make one of the subdomains working, set 8.2 for it, then it is not enough, you have to somehow guess that the main domain version must be raised to 8.2 too and then main domain override by the phpselector plugin to 5.6 (if the main domain site needs such low version).

Can anyone from DirectAdmin tell where is the problem and solve it, avoiding this mess please? I am not admin, just a reseller user.
 
Last edited:
Back
Top