I added ondrej PPA. And tried install php 7.2, but looks like PPA has not been updated yet. What are my workarounds?
Asked
Active
Viewed 7.8k times
19
-
I have a solution for working with php7.2 and apache2 https://askubuntu.com/questions/1231381/unable-to-install-php-7-3-on-ubuntu-20 – Hanslar Maharjan Apr 26 '20 at 19:18
-
1Does this answer your question? Unable to install PHP 7.3 on Ubuntu 20.04 – Mohammad Ghonchesefidi May 02 '20 at 06:36
3 Answers
42
Follow the steps described below.
Add the PPA maintained by Ondrej Surý:
sudo add-apt-repository ppa:ondrej/php
Install PHP version 7.2:
sudo apt install php7.2
Select the standard version of PHP:
sudo update-alternatives --set php /usr/bin/php7.2
Disable version 7.4 or the one you are using:
sudo a2dismod php7.4
Enable version 7.2:
sudo a2enmod php7.2:
Restart the Apache server
sudo systemctl restart apache2
Hope this helps!

BeastOfCaerbannog
- 14,585

Airon Gabriel
- 521
-
-
@Patoshiパトシ Try
echo
phpinfo()
to see current version of php. Great answer! – HalfMens Jun 14 '21 at 18:27
2
You could try adding the eoan/main PPA... Although, this is likely not a preferred route to follow.
$ sudo su
$ cp /etc/apt/sources.list /etc/apt/sources.list.bkp
$ echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu eoan main" >> $ /etc/apt/sources.list
$ apt update
$ apt install php7.2 php-pear php7.2-gd php7.2-dev php7.2-zip php7.2-mbstring php7.2-mysql php7.2-xml php7.2-curl
$ exit

PipIWYG
- 41
- 1
- 6
-
This seems to have worked fine for me. I can confirm that I'm running both PHP 7.2 and PHP 7.4 on Apache2 and MySQL. – PipIWYG Apr 27 '20 at 14:26
0
Today I just realize that with lates ubuntu PPA update older PHP version is available now. So to install php7.3 or 7.2 just sudo apt update and you are ready to go!

Mohammad Ghonchesefidi
- 131
- 6