Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

E: Couldn't find any package by glob 'php-7.4'

Tags:

php

ubuntu

I am using Ubuntu 22.04.1 I am having issues with php version's installation Specially php7.4. enter image description here

I have tried with these reference but it did't work for me.

https://www.linuxcapable.com/how-to-install-php-7-4-on-ubuntu-20-04-lts/

How can I install php7.4 on Ubuntu 19.04?

https://www.codegrepper.com/code-examples/php/%3A+Unable+to+locate+package+php7.4-fpm

Please help !!! Thanks.

like image 769
Parmar Kamalnayan Avatar asked Oct 21 '25 03:10

Parmar Kamalnayan


1 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.

like image 178
azam45 Avatar answered Oct 23 '25 18:10

azam45