Control Web Panel
WebPanel => PHP => Topic started by: Andrew C on August 17, 2022, 04:48:28 PM
-
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.
-
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"
-
'/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 ?
-
use " locate /bin/php" to find all of the php versions installed on your system