Author Topic: How to change the shell ssh php version without affecting php-fpm selector  (Read 2380 times)

0 Members and 1 Guest are viewing this topic.

Offline
*

I'm using php-fpm selector to specify the version of php to use for a website and that works well.

However when I use an ssh terminal as either root or as the user account the php version in the shell is only 5.6.37.

I need to run some scripts in a shell on a website that needs a later version of php.

How do you change the php version for the "root shell" and a "user account" shell without affecting php-fpm selector operation ?

Thanks.

Offline
****
locate the .bashrc file in the users home account.

Add an alias
alias php='/path/to/bin/php'


logout and log back in to check that php -v now shows the correct php version

alternatively, you can set multipl aliases

ex:
alias php71='/usr/local/cwp/php71/bin/php'
alias php72='/usr/local/cwp/php72/bin/php'

Then just run "php71 file.php"
« Last Edit: August 18, 2022, 03:16:34 AM by rcschaff »
Google Hangouts:  rcschaff82@gmail.com

Offline
*

'/usr/local/cwp/' only contains php71 which is dated when the cwp server was built.

How do you change or add more php versions to this directory ?

Or should I be using a different php directory ?

Offline
****
use " locate /bin/php" to find all of the php versions installed on your system
Google Hangouts:  rcschaff82@gmail.com