Using a different PHP version in the terminal

PHP-CLI uses system values and the system version, which may not be the one you’re looking for, so you might encounter some errors. To use different PHP versions in the terminal within cPanel, you need to type ea-phpXX, where XX is the PHP version.

For example, 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 higher/different version, we type

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.

Example if php-cli default php is lower php version like in our example, and you need higher to update composer you can use command:

ea-php80 /opt/cpanel/composer/bin/composer update
Scroll to Top