0

Running Ubuntu 18.04.1, I followed instructions I've found in various places to install PHP 7.3, as follows:

$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ondrej/apache2
$ sudo apt-get update
$ sudo apt-get install php7.3
# the following line installs the same packages for 7.3 that are installed for 7.2
$ sudo apt install $(apt list --installed | grep php7.2- | cut -d'/' -f1 | sed -e 's/7.2/7.3/g')
$ sudo service apache2 stop
$ sudo a2dismod php7.2
$ sudo a2enmod proxy_fcgi setenvif
$ sudo a2enconf php7.3-fpm
$ sudo service apache2 start

The command systemctl status php7.3-fpm shows:

php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager ... active (running)

If I run index.php containing phpinfo() I get

PHP Version 7.3.26-1+ubuntu18.04.1+deb.sury.org+1

BUT the command php -v still shows

PHP 7.2.34-9+ubuntu18.04.1+deb.sury.org+1

I'm trying to install some items via Composer that fail because they depend on PHP 7.3. I assume the problem is related to the php command still going to 7.2.

Just in case, I did apt update and apt upgrade followed by a reboot of Ubuntu, but no change (didn't expect it to help).

What am I missing?

Marshall Morrise
  • 291
  • 2
  • 10
  • 1
    Because CLI is different from Apache. You have the codes to switch the version that Apache uses, but not the CLI version. – aynber Jan 26 '21 at 16:54
  • Thanks @aynber. I assume that if I fix the CLI problem, Composer will look at that to get the proper PHP version? – Marshall Morrise Jan 26 '21 at 16:59
  • 1
    Correct. Composer is command line, therefore uses the command line version of PHP – aynber Jan 26 '21 at 17:01

0 Answers0