Using a different php version in the terminal

PHP-CLI uses system values as well as the system version which is probably not the one you are looking for and hence you are getting some errors. In order to use other php versions in the terminal in cpanel you have to type ea-phpXX where XX is the php version.

Let's say when we type.

php -v PHP 7.3.28 (cli) (built: May 12 2021 17:08:25) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.28, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader + ionCube24 v10.4.5, Copyright (c) 2002-2020, by ionCube Ltd.

And if we need a larger version, we are typing

ea-php74 -v PHP 7.4.19 (cli) (built: May 12 2021 13:11:42) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with the ionCube PHP Loader + ionCube24 v10.4.5, Copyright (c) 2002-2020, by ionCube Ltd.

This enables the use of the desired php version.

Let's say:

ea-php80 /opt/cpanel/composer/bin/composer update

Or for WP CLI

ea-php81 /usr/local/bin/wp --info
Scroll to Top