E: Unable to locate package <pkg name> - php

I am new to php and drupal.my problem is i tried to install php and related pkgs in terminal.I followed this command to install php5
sudo apt-get install php5 php5-cli php5-common php5-devel php5-mbstring php5-gd php5-mysql php5-pdo php5-xmlrpc php5-xml php5-pear
after i entered this command i saw the error like as below.
E: Unable to locate package php5-devel
E: Unable to locate package php5-mbstring
E: Unable to locate package php5-pdo
E: Unable to locate package php5-xml
E: Unable to locate package php5-pear
I tried many ways to get solution for this but i didn't got solution to this.After many hours i taken reinstall ubuntu after that again same error is shows me. Can any one help me from this headache error.

Try replacing php5 with php like so sudo apt-get install php-curl or if you have php7.0 installed use this command sudo apt-get install php7.0-curl.
You can check your php version using command php -v.

Related

Use ODBC in PHP7.4 - Unable to locate package php7.4-odbc

I need to use functions from PHPs ODBC library (like odbc_connect) on my Ubuntu 16.04.6 LTS Server. Unfortunately, if I try to install php7.4-odbc with
sudo apt-get install php7.4-odbc
is fails with
E: Unable to locate package php7.4-odbc
E: Couldn't find any package by glob 'php7.4-odbc'
E: Couldn't find any package by regex 'php7.4-odbc'
How can I install PHPs ODBC package on this Server?
try this
sudo apt update
sudo apt install php-odbc

I can't upgrade nginx PHP version to latest on ubuntu 16

I have tried to upgrade the PHP version. but I just get errors.
I tried this tutorial.
apt update
apt upgrade
apt install software-properties-common
add-apt-repository ppa:ondrej/nginx
apt update
apt upgrade
apt install php8.0 php8.0-cli php8.0-fpm php8.0-apcu php8.0-opcache
php8.0-common php8.0-pear php8.0-curl php8.0-zip php8.0-mcrypt php8.0-mysql
php8.0-mbstring php8.0-xml php8.0-gd php8.0-gmagick php8.0-imagick
php8.0-xmlrpc php7.3-maxminddb
but I get this error.
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php8.0
E: Couldn't find any package by glob 'php8.0'
E: Couldn't find any package by regex 'php8.0'
E: Unable to locate package php8.0-cli
E: Couldn't find any package by glob 'php8.0-cli'
E: Couldn't find any package by regex 'php8.0-cli'
E: Unable to locate package php8.0-fpm
E: Couldn't find any package by glob 'php8.0-fpm'
E: Couldn't find any package by regex 'php8.0-fpm'
E: Unable to locate package php8.0-apcu
E: Couldn't find any package by glob 'php8.0-apcu'
E: Couldn't find any package by regex 'php8.0-apcu'
E: Unable to locate package php8.0-opcache
...
How can I solve this problem?
I have tried my tutorial. but just get same error like this.
As stated in the ppa description:
Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided.
Ubuntu 16.04 is no longer supported since April 2021, so I think there is also no longer a xenial branch of php 8.0. I'd suggest to upgrade Ubuntu to ver. 20.04 LTS in order to be able to use php 8.0
Try apt full-upgrade and apt upgrade and the last command apt get update
try this three command, and restart the machine it will resolve.

php 7.3 Unable to locate package php7.3-gd

I'm trying to install the php7.3-gd extension.
When I try to: sudo apt-get install -y php7.3-gd
I recieve the output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.3-gd
E: Couldn't find any package by glob 'php7.3-gd'
E: Couldn't find any package by regex 'php7.3-gd'
I tried to update my repo using the following awnser but to no avail.
Edit: I'm on ubuntu 19.08
php7.3-gd is available on Ubuntu 19.10.
First, you need upgrade your ubuntu to 19.10:
sudo do-release-upgrade -d
And then you can install it:
sudo apt install php7.3-gd

Not able to re-install php again on ubuntu

I want to update php version from 7.0 to 7.1 so i tried update php commands to update php version on ubuntu system.
But its not updated, so i removed php 7.0 version using purge command
sudo apt-get purge 'php*'
These are the commands i tried for update php7.1 version after uninstall php7.0
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1 php7.1-common
Getting error in command prompt as
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.1
E: Couldn't find any package by glob 'php7.1'
E: Couldn't find any package by regex 'php7.1'
E: Unable to locate package php7.1-common
E: Couldn't find any package by glob 'php7.1-common'
E: Couldn't find any package by regex 'php7.1-common'
What im missing or did any thing wrong here?
It seems like php7.1 and php7.1-common packages are not available in your apt's sources.
I am assuming you are using the latest Ubuntu 18 LTS.
You could install php7.2 from the repositories, however older versions are not included anymore. You would have to install them manually.
For Version 7.2
sudo apt update
sudo apt install php7.2 php7.2-common
php -v
For Version 7.1
Download php
Extract the downloaded archive
Follow the included readme file
other options
If you are developing with different versions of PHP you might want to look into PHP docker containers
PHPDocker.io can be a good starting point.
EDIT: Also maybe consider posting this question on askubuntu instead, they might have more specific knowledge there.
You need to remove the old version before adding the new one.
Try: sudo apt-get remove php7.0*
Also it is useful to list all php packages to check if you are installing all you need.
sudo apt-get list php*
Then it is safe to run your commands.

how to install php5.5 in ubuntu 17.10

I have few projects which are developed on php5.5.9. So I am trying to install php5.5.9 in ubuntu 17.10 but it is showing error.
I have used the below command:
sudo apt-get install php5.5
It's showing the following error:
E: Unable to locate package php5.5
E: Couldn't find any package by
glob 'php5.5' E: Couldn't find any package by regex 'php5.5'
Could you please help me.
PHP 5.5 is no longer supported - http://php.net/supported-versions.php
You can install 5.6 using ppa:ondrej/php:
https://launchpad.net/~ondrej/+archive/ubuntu/php
Or you can compile from source, it's not so complicated:
https://secure.php.net/get/php-5.5.9.tar.gz/from/a/mirror
You receive the error because php5 is outdated.
Execute : sudo apt-get install php7.0-imap
on the other way: use version:
try sudo apt-get install php5.5-rpm
or
try sudo apt-get install php5.5-rpm
You can get php5.5 tar file from old archive in php official site.
To install from source I followed this link. Its working good.

Categories