Help, php -v shows 7.0.33 but I am running 7.3.22, I think!?

In my Plesk 18 panel, all my sites show that they are using PHP 7.3.22 and this has been confirmed on my various sites via phpinfo. However, when I execute php -v under Ubunto 16.04 console, it reports PHP version as 7.0.33 and an app that uses Composer won’t update because of this.

What? Help please!

there may be multiple installations of PHP on your machine and CLI uses a different version then your webserver, contact your administrator.

1 Like

I’m the Admin. :slight_smile: It’s a dedicated, un-managed server and I have full root console and SFTP access. I only found PHP here: /opt/plesk/php/7.3/etc and phpinfo(); shows 7.3.22, but in console, php -v shows 7.0.33. How do I upgrade it? I found no reference at all to PHP 7.0.33 in phpinfo();, only 7.3.22. Very strange.

Here’s the full php -v result:

PHP 7.0.33-0ubuntu0.16.04.7 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.4.0, Copyright (c) 2002-2020, by ionCube Ltd.
with Zend OPcache v7.0.33-0ubuntu0.16.04.7, Copyright (c) 1999-2017, by Zend Technologies

I’m confused…

what does whereis php say?

/usr/bin/php7.0 /usr/bin/php /usr/lib/php /etc/php /usr/include/php /usr/share/php7.0-curl /usr/share/php7.0-sqlite3 /usr/share/php7.0-mysql /usr/share/php7.0-common /usr/share/php7.0-readline /usr/share/php7.0-gd /usr/share/php7.0-mcrypt /usr/share/php7.0-zip /usr/share/php /usr/share/php7.0-xml /usr/share/php7.0-mbstring /usr/share/php7.0-opcache /usr/share/php7.0-json /usr/share/php7.0-imap /usr/share/man/man1/php.1.gz

Hmmm…

so obviously there’s some php 7.0 installed on your server.

Yup, saw that. So how do I upgrade it? Or set 7.3 as default? :slight_smile:

you can run exec('whereis php') from within PHP and set your $PATH variable in the linux shell accordingly

Sounds good. But how exactly do I do that?

just like the manual says

https://www.php.net/manual/en/function.exec.php

1 Like

Okay gotcha. So I see where the PHP files are, then set PATH to point to it. :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service