I have recently install php7.2 on debian
#!/bin/bash
apt-get install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg
https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
apt-get update
apt-get install php7.2-fpm php7.2-cli php7.2-xml
apt-get install php-curl
apt-get install php7.2-mysql
# Si apache
apt install libapache2-mod-php
a2enconf php7.2-fpm
service php7.0-fpm restart
service php7.2-fpm restart
a2dismod php7.0
a2enmod php7.2
service apache2 restart
when i try to install php-redis, (for apache) i have error during install of sub library
Preparing to unpack .../php-igbinary_2.0.1-1+0~20170825111222.1+jessie~1.gbp48b058_amd64.deb ...
Unpacking php-igbinary (2.0.1-1+0~20170825111222.1+jessie~1.gbp48b058) ...
dpkg: error processing archive /var/cache/apt/archives/php-igbinary_2.0.1-1+0~20170825111222.1+jessie~1.gbp48b058_amd64.deb (--unpack):
trying to overwrite '/etc/php/7.0/mods-available/igbinary.ini', which is also in package php7.0-igbinary 2.0.1-1~dotdeb+8.1
Errors were encountered while processing:
/var/cache/apt/archives/php-igbinary_2.0.1- 1+0~20170825111222.1+jessie~1.gbp48b058_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
For repaire it, i have try to clean
apt-get purge php-redis
apt-get purge php-igbinary
apt-get clean
After i try to reinstall :
root#ns327838:~# apt-get install php7.2-redis
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php-redis' instead of 'php7.2-redis'
The following extra packages will be installed:
php-igbinary
The following NEW packages will be installed:
php-igbinary php-redis
0 upgraded, 2 newly installed, 0 to remove and 66 not upgraded.
Need to get 326 kB of archives.
After this operation, 2,317 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://packages.sury.org/php/ jessie/main php-igbinary amd64 2.0.1-1+0~20170825111222.1+jessie~1.gbp48b058 [43.4 kB]
Get:2 https://packages.sury.org/php/ jessie/main php-redis amd64 4.0.0-1+0~20180412074203.5+jessie~1.gbp24a357 [282 kB]
Fetched 326 kB in 0s (654 kB/s)
(Reading database ... 62943 files and directories currently installed.)
Preparing to unpack .../php-igbinary_2.0.1-1+0~20170825111222.1+jessie~1.gbp48b058_amd64.deb ...
Unpacking php-igbinary (2.0.1-1+0~20170825111222.1+jessie~1.gbp48b058) ...
dpkg: error processing archive /var/cache/apt/archives/php-igbinary_2.0.1-1+0~20170825111222.1+jessie~1.gbp48b058_amd64.deb (--unpack):
trying to overwrite '/etc/php/7.0/mods-available/igbinary.ini', which is also in package php7.0-igbinary 2.0.1-1~dotdeb+8.1
Selecting previously unselected package php-redis.
Preparing to unpack .../php-redis_4.0.0-1+0~20180412074203.5+jessie~1.gbp24a357_amd64.deb ...
Unpacking php-redis (4.0.0-1+0~20180412074203.5+jessie~1.gbp24a357) ...
Errors were encountered while processing:
/var/cache/apt/archives/php-igbinary_2.0.1-1+0~20170825111222.1+jessie~1.gbp48b058_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Have you got idea ?
Thank you in advance
Related
I am trying install libapache2-mod-php7.3 on my ubuntu server 16.04.
I am getting below error
sudo apt install libapache2-mod-php7.3
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libapache2-mod-php7.3
E: Couldn't find any package by glob 'libapache2-mod-php7.3'
E: Couldn't find any package by regex 'libapache2-mod-php7.3'
Please help me install the libapache2 module on my server.
Thanks
Have you tried this?
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.3 php7.3-cli php7.3-mysql php7.3-gd php7.3-imagick php7.3-recode php7.3-tidy php7.3-xmlrpc php7.3-common php7.3-curl php7.3-mbstring php7.3-xml php7.3-bcmath php7.3-bz2 php7.3-intl php7.3-json php7.3-readline php7.3-zip
sudo apt install libapache2-mod-php7.3
sudo a2enmod php7.3
after successfully installing, execute :
sudo service apache2 restart
FYI, I recommended you use the latest PHP or switch to the LTS version.
You can find out on https://www.php.net/supported-versions.php
I am getting this error message when I try to install mysql-server-5.6: sudo apt-get install mysql-server-5.6:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
mailx tinyca
The following NEW packages will be installed:
mysql-server-5.6
0 upgraded, 1 newly installed, 0 to remove and 25 not upgraded.
Need to get 0 B/6,004 kB of archives.
After this operation, 52.7 MB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 75769 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.6_5.6.35-1+deb.sury.org~xenial+0.1_amd64.deb ...
Aborting downgrade from (at least) 5.7 to 5.6.
If are sure you want to downgrade to 5.6, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.6_5.6.35-1+deb.sury.org~xenial+0.1_amd64.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-5.6_5.6.35-1+deb.sury.org~xenial+0.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
mysql-client-5.6 were installed normally.
I first, uninstalled mysql-server-5.7:
sudo apt-get remove dbconfig-mysql
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
I added repos using this 2 methods:
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
sudo apt-get update
and
sudo add-apt-repository -y ppa:ondrej/mysql-5.6
sudo apt-get update
Notice that I also installed PHP 5.6 without any problem.
Since all my project depend on MCRYPT, I have to install this version in order to it to works well.
I used mysql-server-5.7 but it is not compatible ... datas are not inserted into mysql server.
Your help is needed, thank you in advance.
I think the issue is with the mysql client, because you already have it and it is trying to install it, which is causing the error.
Run this command to cleanup unused libraries:
sudo apt-get autoremove
and then try to install it again
I'm using Google Cloud Compute Engine for our web servers. We run our webapps on PHP7.2 using Ondřej Surý’s PPA.
We have a startup script to install all the required packages and doing the configuration:
apt install -y apache2 php7.2 php7.2-common php7.2-cli php7.2-mysql php7.2-json php7.2-opcache php7.2-readline php7.2-intl php7.2-mbstring php7.2-zip php7.2-curl php7.2-xml php7.2-memcached php7.2-imagick php7.2-bcmath php7.2-json
a2dismod php7.0
a2enmod php7.2
update-alternatives --set php /usr/bin/php7.2
update-alternatives --set phar /usr/bin/phar7.2
update-alternatives --set phar.phar /usr/bin/phar.phar7.2
update-alternatives --set phpize /usr/bin/phpize7.2
update-alternatives --set php-config /usr/bin/php-config7.2
On the inital setup of the virtual machine everything works and all the packages get installed without problems.
But when we need to install new php7.2-XXX packages or when there are updates of installed packages we always run into configuration errors like the one below:
So when we run apt -y upgrade we end up getting these errors:
Setting up php7.2-common (7.2.20-1+ubuntu16.04.1+deb.sury.org+1) ...
Internal error!
dpkg: error processing package php7.2-common (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of php7.2-curl:
php7.2-curl depends on php7.2-common (= 7.2.20-1+ubuntu16.04.1+deb.sury.org+1); however:
Package php7.2-common is not configured yet.
dpkg: error processing package php7.2-json (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php7.2-opcache:
php7.2-opcache depends on php7.2-common (= 7.2.20-1+ubuntu16.04.1+deb.sury.org+1); however:
Package php7.2-common is not configured yet.
...
Ending in:
Errors were encountered while processing:
php7.2-common
php7.2-json
php7.2-opcache
php7.2-readline
php7.2-cli
libapache2-mod-php7.2
php7.2
php7.2-bcmath
php7.2-curl
php7.2-gd
php7.2-intl
php7.2-mbstring
php7.2-mysql
php7.2-soap
php7.2-xml
php7.2-zip
E: Sub-process /usr/bin/dpkg returned an error code (1)
What I tried:
rebooting
apt autoremove
apt autoclean
apt clean
re-running our startup script
dpkg --configure php7.2-common resulted in:
Setting up php7.2-common (7.2.20-1+ubuntu16.04.1+deb.sury.org+1) ...
Internal error!
dpkg: error processing package php7.2-common (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
php7.2-common
Luckily our webapps seem to be functioning just fine.
Been looking around for weeks now to find more info on these errors.
I can understand that you are currently experiencing issues while trying to install/update PHP packages, even though your instances seem to be working fine; I would firstly recommend you to force an installation in case that 'package install' was interrupted previously, please try the following command:
sudo apt-get install -f
If you are still unable to install the PHP 7.2 packages, please remove post info files of the troublesome package; you can try removing the files associated to the package in question from /var/lib/dpkg/info.
Due to the fact that you're having issues with all of php7.2, look for the files associated with it:
ls -l /var/lib/dpkg/info | grep -i php7.2
Thereafter try to moving them (temporarily) to another folder (see command example below):
sudo mv /var/lib/dpkg/info/php7.2-.* /tmp
And finally use sudo apt update and you should be able to install software as usual. Please let me know the results.
I'll be waiting for your response!
Francisco Z.
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
I'm trying to get my server re-setup as a Lemp stack
The issue I am now running into is installing PHP 7 without Apache, since nGinx will be my webserver.
So, I've added ppa:ondrej/php. ran apt-get update, and tried to install just php7.0 via apt-get install php7.0
--nodeps flag does not work, as I am on Ubuntu 15.10
And I am presented with:
The following extra packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.0 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 libqdbm14
php-common php-readline php7.0 php7.0-cli php7.0-common php7.0-json
php7.0-opcache php7.0-readline
Suggested packages:
apache2-doc apache2-suexec-pristine apache2-suexec-custom php-pear
php-user-cache
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php7.0 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 libqdbm14
php php-common php-readline php7.0 php7.0-cli php7.0-common php7.0-json
php7.0-opcache php7.0-readline
I do not want apache anywhere near my server, so how can I install php7 without it? Short of compiling from source (as this makes it difficult at best to keep it updated)
If you just request php7.0, it'll install Apache as default. Do apt-get install php7.0-fpm and it'll install as FPM instead, leaving something like nginx up to you.
Use the command:
sudo apt install php7.2 php7.2-common php7.2-cli php7.2-fpm
It will require the php7.2 dependencies in strict mode (WITHOUT apache2).
On Ubuntu 18.04 I managed to do this successfully with:
sudo apt-get install php7.2-cli
In Ubuntu 20.04, php 7.4 is the default.
Thus, without adding any PPAs, all you need is
apt install php-fpm
This will bring in a few libraries, including php-cli, but NO apache-related things.
With the following steps you can install any PHP version you want, just replace 7.4 with your desired version.
Also I am suggesting to install the cli package because I assume you dont want to have fpm installed. Otherwise you can install php7.4-fpm instead.
Install ppa:ondrej/php repositories
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
Install PHP
sudo apt install php7.4-cli
You will get the following:
The following additional packages will be installed:
php-common php7.4-common php7.4-json php7.4-opcache php7.4-readline