0

In trying to get ImageMagick to work with HEIC, I noticed that while I have Ubuntu 19.10 installed, phpinfo() shows version 19.04. This makes it difficult to know which php.ini to edit, especially as there is a PHP 7.2 folder and a 7.3 folder with phpinfo() reporting that the php.ini is in 7.2.

To add to the confusion, running php -v at the command line shows the expected versions, not the earlier versions shown in phpinfo. How does one get all this into sync and remove the older unused versions?

php -v
PHP 7.3.12-1+ubuntu19.10.1+deb.sury.org+1 (cli) (built: Nov 28 2019 07:38:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.12-1+ubuntu19.10.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
2
  • I would not trust the PHP report from phpinfo() to state the proper Ubuntu version, since those version(s) are included in the version strings when you have multiple packages in repos of the same version. We'd need to see a screenshot of the exact thing you're looking at to give you a better answer, but it's probably a version string in the package and not PHP specifically stating you're on 19.04 (just that the installed PHP7.2 package was originally packaged FOR 19.04) – Thomas Ward Dec 17 '19 at 2:36
  • Thank you for the fast response! I posted the answer, or at least AN answer, that seems to have solved the mismatch. Other postings I read said that what phpinfo() shows is what PHP sees and that Aoache2 doesn't interface with the command line in any way and that makes sense but still I needed PHP to see and use the latest version. I'm not sure how it got out of sync but it may be that the PHP version that I originally installed was not appropriate as I believe it was the CLI version and I'm not sure of the significance. – DonP Dec 17 '19 at 2:54
2

As soon as I posted, I came across the answer which is to disable one PHP version and enable the other.

sudo a2dismod php7.2
Module php7.2 disabled.
To activate the new configuration, you need to run:
  systemctl restart apache2

systemctl restart apache2

sudo a2enmod php7.3
Considering dependency mpm_prefork for php7.3:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.3:
Enabling module php7.3.
To activate the new configuration, you need to run:
  systemctl restart apache2

systemctl restart apache2

Now phpinfo() shows the proper PHP version and the proper Ubuntu version. To remove the older version, I ran:

sudo apt-get purge 'php7.2*'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.