Different PHP versions with SSH

djcart

Verified User
Joined
Jun 29, 2021
Messages
122
I have a small problem. I'm using CloudLinux with DirectAdmin and LiteSpeed. For user accounts, I have set up the ability to change the PHP version for the entire account and domain through the PHP handler in LiteSpeed. When I use the DirectAdmin terminal in SSH, it shows me the correct version that is set for the user account, but when I connect via PuTTY, this version is the default version of the server and an incorrect version appears.

What could be causing this problem?
 
DirectAdmin terminal - do you mean you ssh to user account?
And with Putty, that means you are logging in to root?
 
If you login via Putty to SSH, then the default DA version is shown.

You can best check at the user account with a phpinfo.php file, that also says which php version is active at the account of the user.
 
If you login via Putty to SSH, then the default DA version is shown.

You can best check at the user account with a phpinfo.php file, that also says which php version is active at the account of the user.
The situation mainly concerns remote connection via putty.

When I type


I get a result about PHP 7.4

When I enter this command in the Z DirectAdmin terminal, it shows the global version of php which is 8.1

I tried to do something like this:

#nano ~/.bashrc

I added a line:

alias php='/opt/alt/php81/usr/bin/php'

then after reconnecting through putty, the PHP 8.1 version was shown, but when I went to the composer it still informed me about PHP 7.4

Is there no way to bypass this without changing the main version of PHP for DirectAdmin?
 
Back
Top