I'm trying to install package php7.2-bcmath on Ubuntu 14.4
sudo apt-get install php7.2-bcmath
but I keep getting this error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.2-bcmath
E: Couldn't find any package by regex 'php7.2-bcmath'
I already try those options:
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2-bcmath
add this to /etc/apt/sources.list:
deb http://security.ubuntu.com/ubuntu artful-security main universe
Nothing works!
Please help
You should check which PHP version is available and if you addressed the correct package name.
Use:
apt-cache search php
to check, if PHP7.2 and all the extensions are available at your environment.
Determine the correct package name of the bcmath package by searching trough all available packages:
apt-cache search php | grep bcmath
If you see an bcmath package for php7.2 use this name with the sudo apt-get install .... syntax.
Related
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
I am trying to install curl on my ubunutu 14 server with php 7.2 installed. I run the following command:
sudo apt-get install php7.0-curl
but it gives error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0-curl
E: Couldn't find any package by regex 'php7.0-curl'
I then tried to resolve this issue by running commands:
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt install apache2 libapache2-mod-php7.0 php7.0
But that also end up with same "Couldn't find package" error.
Your Ubuntu distro trusty is too old and those packages aren't available. You will have to build the library from the source by yourself.
Here you can find solution your problem How do I install the ext-curl extension with PHP 7?
Shortly, try to execute
sudo apt-get install php-curl
Also you can use sudo apt-cache search curl which shows you available packages for installation.
I am not being able to install package php7.0-zip. The error I get after doing
sudo apt-get install php7.0-zip
Is:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0-zip
E: Couldn't find any package by regex 'php7.0-zip'
This is for an Ubuntu 14.04.5 LTS. My PHP version is 7.0.17.
I tried doing:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
And still getting the same "unable to locate" error.
I expect to solve my "Fatal error: Class 'ZipArchive' not found in" in Laravel 5.4, after installing zip package.
if you do sudo apt-cache search php7.0-* you should get a list of all packages.
The zip module should be at the bottom
If it isn't there you might wish to try
sudo add-apt-repository ppa:ondrej/php && sudo apt-get update instead of just add-apt-repository ppa:ondrej/php and see if that makes a difference.
Finally I couldn't find the package because I was using Ubuntu 14.04, and as is an unsupported Ubuntu version, there is no more php packages in the repository.
/etc/init.d/mysql status is running active
When I am trying to install php, I get this message:
sudo apt-get install php5.6-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5.6-mysql
E: Couldn't find any package by glob 'php5.6-mysql'
E: Couldn't find any package by regex 'php5.6-mysql'
To find out what packages exist in the repositories:
sudo apt search <package_name>
This will give you a list of packages that you can install, and this will allow you to check if the package php5.6-mysql actually exists (which it probably doesn't).
Once you've done that, you'll be able to install the correct package that you need!
The packages you probably want are php5-mysql and mysql-server.
So simply run:
sudo apt install php5-mysql mysql-server
I got this error when run below command
sudo apt install php7.2 php7.2-common php7.2-cli php7.2-fpm
Reading state information... Done
E: Unable to locate package php7.2
E: Couldn't find any package by glob 'php7.2'
E: Couldn't find any package by regex 'php7.2'
E: Unable to locate package php7.2-common
E: Couldn't find any package by glob 'php7.2-common'
E: Couldn't find any package by regex 'php7.2-common'
E: Unable to locate package php7.2-cli
E: Couldn't find any package by glob 'php7.2-cli'
E: Couldn't find any package by regex 'php7.2-cli'
E: Unable to locate package php7.2-fpm
E: Couldn't find any package by glob 'php7.2-fpm'
E: Couldn't find any package by regex 'php7.2-fpm'
You need to manually add the ondrej PPA to be able to install PHP7.2 on Ubuntu 17.
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.2
Or, by compiling it from the source by cloning the git repository, checking out the version that you want, make & make install
For more informations about compiling PHP from the source check out how to build/compile PHP from the source.
I had a similar problem.
This page helped me resolve it.
https://tecadmin.net/install-php-debian-9-stretch/
specifically, running these commands prior to the php install
sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
Completely remove ALL versions of PHP
sudo apt-get purge 'php*'
Force update from unsigned repository:
Add this option in your sources.list (located at /etc/apt/sources.list):
deb [trusted=yes] https://deb.sury.org/ stretch main
Upgrade the current packages to the latest version:
sudo apt update
sudo apt upgrade
Install the required packages first on your system:
sudo apt install ca-certificates apt-transport-https
Then import packages signing key:
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
After that configure PPA for the PHP packages on your system:
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
Lastly, use one of the below options to install PHP of your requirements:
For installing PHP 7.2
sudo apt install php7.2-cli
For installing PHP 7.1
sudo apt install php7.1-cli
In my case a newer php was installed (7.4), so i just replaced the command with the 7.4 versions
sudo apt install php7.4 php7.4-common php7.4-cli php7.4-fpm
to know the version of php installed, use:
php --version
If you getting error like php7.2 php7.2-curl doesn't have installable candidate or not locate any package or dependencies is php7.2-common Or libcurl3 Do this . Remeber Change your package name as per your requirements
You have to tackle in mature way. Install aptitude these ubuntu package manager will finds all dependencies, and will install one by one.
apt-get install aptitude
Now you have to check if aptitude can download it or not if download it follow instructions
sudo aptitude install php7.2-curl
If you have gotten any error like this
E: Unable to locate package php7.2-curl
E: Couldn't find any package by glob 'php7.2-curl'
Any type on error i'm not talking about proper these errors
Try to add php package again
sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
Now try this command
sudo aptitude install php7.2-curl
Aptitude will ask you you want to keep current version of all dependencies
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) php7.2-curl [Not Installed]
Accept this solution? [Y/n/q/?]
Type n then Enter
Aptitude will find all dependencies and ask you to install all package type
y
Again
y
Then
systemctl restart apache2
For centos of rhel
systemctl restart httpd
It will Not enabling PHP 7.2 FPM by default.
NOTICE: To enable PHP 7.2 FPM in Apache2 do
a2enmod proxy_fcgi setenvif
a2enconf php7.2-fpm
This method is not only for this error you can find any of php apache2 or ubuntu system package solution using aptitude.
Upvote if you find your solution