E: Couldn't Find Any Package by Glob 'Php-7.4'
I Am Using Ubuntu 22.04.1 I Am Having Issues with Php Version's Installation Specially Php7.4. I Have Tried with These Reference but It Did't Work for Me. How...
I am using Ubuntu 22.04.1 I am having issues with php version's installation Specially php7.4.
I have tried with these reference but it did't work for me.
How can I install php7.4 on Ubuntu 19.04?
Please help !!! Thanks.
2 Answers
Hit the following commands to install php at any version (replace php7.4 with your required version) in Linux OS:
sudo apt-get update
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php7.4
Check PHP Version :
php -v
You may need some other packages to install. You can do so by following the commands :
sudo apt-get install -y php7.4-cli php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath
sudo apt install php7.4-fpm
Start FPM and check status :
systemctl restart php7.4-fpm
systemctl status php7.4-fpm
The above-mentioned actions resolved the problem.
If Still You are Facing below Error (Then Try tricky solution) its not official but worked for me.
Error: Unable to locate package php7.4
Scenario: I was using Ubuntu 20 in azure after trying all documents and efforts but couldn't install PHP.
Solution: I just replaced /etc/apt/source.list file content with fresh Ubuntu 20 /etc/apt/source.list file content and then It worked :-)
Reference Docs :