How can I install PHP 7.2 on Ubuntu 19.10? We use PHP 7.2 in production and I need my local environment to match.

I can't find any repos that provide it since 7.2 was the default in 19.04, but it seems to be completely removed from 19.10.

I've tried downloading and installing the PHP 7.2 tar.gz from PHP.net, but it's missing the apache2 mod, so Apache can't find it.

Update: Ondřej Surý has updated his PHP repo to support Ubuntu 19.10. This guy is a saint! Instructions to install: https://tecadmin.net/install-php-7-on-ubuntu/

  • In case someone else finds it useful, I was able to download the Ubuntu 19.04 packages from here: pkgs.org/download/php7 I downloaded them all to a new folder then ran dpkg -i * Not an ideal solution, but it seems to be working okay so far. I really hope Ubuntu realizes that people still use old (but still supported) versions of packages. Or maybe Sury is working on the problem and will add it to his repo. – AdamM Oct 23 '19 at 20:24

I ran into the same problem. Just to make sure I had all related PHP packages installed, I ran:

sudo apt install php libapache2-mod-php php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-zip php-curl

After that I restarted apache2 which still did not do the trick. PHP 7.3 needs to activated fpr apache manually. You might have seen the following message:

Processing triggers for php7.3-fpm (7.3.8-1) ...
NOTICE: Not enabling PHP 7.3 FPM by default.
NOTICE: To enable PHP 7.3 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.3-fpm
NOTICE: You are seeing this message because you have apache2 package installed.

So, following the advice

a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm
service apache2 restart

and restarting apache2 was succesful in the end. I hope this helps.

| improve this answer | |
  • 2
    The issue is that I need PHP 7.2, not 7.3. I can see the 7.3 packages available through apt, I just can't find any 7.2 packages. – AdamM Oct 24 '19 at 11:43
  • This answer does not fix the problem as php7.3 is working perfectly on ubuntu. – Christophe Ferreboeuf Dec 2 '19 at 8:08

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.