PHP Version not correct in SSH

Hi there.
I have a Virtual Server and I have set the PHP version to PHP 7.2 (via Server Configuration -> PHP Version).

Its a Wordpress site, and when I log into the admin area, this shows correctly as using PHP 7.2.

However, when I log in via SSH, and run PHP-V, the version returned is 5.4.16.

This means I can’t use the WP CLI. When I try to, I get the following:

Your server is running PHP version 5.4.16 but WordPress 5.2.1 requires at least 5.6.20.

Can anyone help please?



The default PHP version on CentOS is indeed PHP 5.4… however, if there’s additional PHP versions installed, you can call them if you know the correct path.

To see the path of all the PHP versions installed, you can go into System Settings -> Re-Check Config, and it’ll show you the path of all the PHP versions it detects.


Hi Eric,
Thanks for the reply.

I have done that now, and it has detected the new ones I’ve added.

The following PHP versions are available : 5.4.16 (/bin/php-cgi), 5.6.25 (/opt/rh/rh-php56/root/usr/bin/php-cgi), 7.0.27 (/opt/rh/rh-php70/root/usr/bin/php-cgi), 7.1.8 (/opt/rh/rh-php71/root/usr/bin/php-cgi), 7.2.10 (/opt/rh/rh-php72/root/usr/bin/php-cgi), 5.4 (mod_php)

No PHP-FPM packages were found on this system.

PHP versions have changed to 5, 5.4, 5.6, 7.0, 7.1, 7.2 since last check. Regenerating any missing php.ini files

What should I do now?


The output there shows you the paths for all the additional PHP versions you have installed… so you can use those paths to get your desired PHP rather than using the default “php”, which is only PHP 5.4.


Sorry I’m a bit lost.

I’ve already set the php version against the virtual server.

Is just when I use wp cli via ssh.

How do I sort this?
Thanks for the reply by the way, really appreciate it

You’ll need to configure your wp-cli binary to use your preferred PHP version.

I’m not personally familiar with how to do that, but I see some examples here:

I’ll give it a go to see if I can follow it.

Failing that, is there no way to set the default to a later version?

So - apparently this is CentOS and you installed the updated PHP versions as recommended from one of the SCL-styled repos, so just type

scl enable php72 bash and your path will be set to use the proper PHP executable. Better, put this in your shell initialization and it'll get set automatically. Or just change your path to include the proper path to PHP in your shell initializations before the /usr/bin .

Hi All,

I’m still having issues with this, can’t for the life of me get WP CLI to work from SSH terminal, because the default version is 5.4.

How can I change the default to the latest I have, which is 7.2. The path is /opt/rh/rh-php72/root/usr/bin/php-cgi

Thanks in advance,