I recently restored my personal test server with a completely fresh install of Debian 8.
The Service Provider where I purchased the Virtual Server, has only the Debian 8 option. So there is currently no possibility to upgrade to stretch or buster (9 and 10).
I need to install at least PHP 7.2 on my server to meet the requirements for the project and I'm having a hard time accomplishing that. As www.dotdeb.org seems to be discontinued I am wondering what package source I should add for PHP 7.2. All I found googling around was when dotdeb was still providing 7.2 packages.
My sources.list looks like this:
deb http://debian.mirror.serverloft.de/debian/ jessie main contrib non-free
deb http://debian.mirror.serverloft.de/debian-security/ jessie/updates main contrib non-free
deb http://packages.dotdeb.org jessie all
deb https://packages.sury.org/php/ jessie main
deb-src http://packages.dotdeb.org jessie all
but when I do
apt-get uptate
apt-get install php 7.2
I get
E: Unable to locate package php7.2
E: Couldn't find any package by regex 'php7.2'
Maybe there is no such option anymore and I have to change the provider to get a higher Debian version?
You can install the php 7.2 or later in debian jessie. But you need to follow some steps for getting this. The main reason is debian platform has been stopped the sury package service for jessie. Please check this link https://packages.sury.org/php/dists/
Now you know, it's not have the jessie support.
Okay Now we start the process of php 7.2 installation
Open /etc/apt/sources.list and add deb http://ftp.de.debian.org/debian stretch main.
It helps to get the stretch repos for the supporting dependencies of php 7.2
$ sudo apt update
$ sudo nano /etc/apt/sources.list.d/php.list.
then add deb https://packages.sury.org/php/ stretch main. this is also a stretch repo
$ sudo apt update
Now the php needs the updation of libncurses5 >= 6
check the current available version of libncurses5
$ sudo apt search libncurses5 //it shows you the libncurses5 as 6.0
$ sudo apt install libncurses5
$ sudo apt-get install php7.2 php7.2-readline php7.2-cli php7.2-fpm
$ sudo apt install php7.2-common php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-curl php7.2-gd php7.2-imagick php7.2-dev php7.2-imap php7.2-mbstring php7.2-opcache php7.2-soap php7.2-zip php7.2-intl -y
check unix socket is found in /var/run/php
Now you found php7.2-fpm.sock in this directory
Last step. just start the php service: $ sudo service php7.2-fpm start
Now you check the status and version of php $ sudo service php7.2-fpm status && $ php -v
Hurray. you got the newest version of php. Thanks a lot
Note: Don't forget to stop the previous service for php in your machine
I've got PHP 8.0 from this all-in-one bundle: https://bitnami.com/stack/lapp/installer
It does not depend on Linux distro
Related
I am trying to install ZeroMQ extension for PHP using Docker image php:7.4-apache-buster.
The package is found when running apt list:
$ sudo apt update && apt list php-zmq outputs php-zmq/stable 1.1.3-9 amd64
It is not possible to install it however:
$ sudo apt install php-zmq outputs E: Package 'php-zmq' has no installation candidate
I have checked that the package is not already installed using apt list --installed php-zmq. Underlying libzmq5 library is present on the system.
I wonder how does apt list command work that it suggests packages which apt install is unable to install.
Thanks for any help.
The package php-zmq is available in debian main repository , you need to edit your sources as follows:
deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian-security/ buster/updates main
deb http://deb.debian.org/debian buster-updates main
Edit
Manual install:
sudo apt install gdebi
wget http://ftp.us.debian.org/debian/pool/main/p/php-defaults/php-common_69_all.deb
wget http://ftp.us.debian.org/debian/pool/main/p/php-zmq/php-zmq_1.1.3-9_amd64.deb
sudo gdebi php-common_69_all.deb
sudo gdebi php-zmq_1.1.3-9_amd64.deb
I am trying to setup phppgadmin and it requires php5-fpm but as I have ubuntu 16.04 and it comes with php 7. So when i try to run install php5-fpm it give me following error:
sudo apt-get install php5-fpm
Package php5-fpm is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php5-fpm' has no installation candidate
I can't use php7-fpm as phppgadmin requires only php5-fpm. When I run sudo apt-get install php-fpm it installed php7-fpm . I am using nginx as web server. I tried many ppa but none of them worked for me.
TL;DR: If you want to stay with php5, you will need to stay at Ubuntu 14.04 LTS
You can use phpbrew to install older/different php-version, that are not part of the actual package-repositories of ubutu.
phpbrew builds and installs multiple version php(s) in your $HOME directory.
Another way is to modify the sources.list and a repository which still provides php5 packages. But you really should not do that!
You will need to use a PPA to do this. Consider:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php-xdebug libapache2-mod-php5.6
That's PHP5.6, not exactly PHP5-FPM. I don't think FPM is in that PPA but it's a close enough solution. Maybe you can find an FPM PPA but I'm not seeing one at first glance.
I tried installing php in ubuntu 16.04 using following command:
sudo apt-get install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7
but it says
Unable to locate package libapache2-mod-php7
Should I skip this or install by an alternative way?
The name of the package is libapache2-mod-php7.0
Try again by having that .0 at the end and it should work.
On Ubuntu 18.04, I had to add the repository below first. Once the repo was added I was able to install the php7.x items.
sudo add-apt-repository ppa:ondrej/php
Source: https://websiteforstudents.com/apache2-with-php-7-1-support-on-ubuntu-18-04-lts-beta-server/
If you are using Ubuntu 17.04/17.10 or above use php7.1 instead of 7.0 since it is no longer available.
sudo apt-get install php7.1
At the time of the post Ubuntu 16.04 was one of the newer versions and as such the packages changed to php7.0 but as time goes on it will be 7.1 to 7.2 etc... and I don't have the time to figure out what was the latest package and I'm not dependent on a specific version.
So if you want the latest version of packages to install without having to know the correct version number just drop the version number and the latest applicable to the distribution you are using will be installed.
In my case I was using Ubuntu 17.10 and the php version is different so I used the following command line to get the latest.
sudo apt-get install apache2 php-mysql libapache2-mod-php mysql-server
It installed php 7.1 and all of the correct dependencies.
So if you don't require a specific version but just want the latest that works with the distribution drop the version number and use the command line above.
It is likely the case that your local package index is not updated; try
sudo apt-get update
and then run the previous command again.
As an aside, there is now a program apt that is supposedly more user-friendly than apt-get, apt-cache etc. (see this question on Ask Ubuntu). So your commands could have been replaced by
sudo apt update
sudo apt install <the packages>
to get a slightly nicer user interface.
Probably this question would have been better suited to the Ask Ubuntu community.
Apache server can't start because libapache2-mod-php7.0 is not installed:
by default aptitude or apt install php7.0-common version 7.8.13 which is not adaptable and libapache2-mod-php need 7.0.8
remove php-common
download http://packages.ubuntu.com/xenial/php7.0-common deb package and install it if it compains about php7.0-json, readline,cli,opache
then seatch in upper textbox about those library and install them in this manner
json
opach
cli
readline
install libapache2-mod-php7.0
RESTART APACHE 2
service apache2 restart
it must working probably
Good Luck!
Try for Ubuntu 16.04:
sudo apt-get update;
sudo apt-get install php7.0-fpm php7.0-mysql <other packages>;
for Ubuntu 14.04:
sudo apt-get update;
sudo apt-get install php5-mysql php5-mysql <other packages>;
It should be:
sudo apt-get install libapache2-mod-php7.0
sudo apt-get install libapache2-mod-php7.1
worked for me (16.04Ubuntu).
If you getting error like php7.2 php7.2-curl libapache2-mod-php 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
Looks like we need to install the same version of libapache2-mod-php as the version of php present .I had php 7.4 installing libapache2-mod-php7.4 solved the problem.Thanks
just test upper versions of php
for example run:
sudo apt-get install php7.4-mysql php7.4-curl php7.4-json php7.4-cgi php7.0 libapache2-mod-php7.4
I want to migrate my web server from unsupported version of ubuntu 12.10.
I installed 16.04 and installed apache2, php7, mysql and phpmyadmin.
When I want to use phpmyadmin I have error that mbstring missing.
In PHP.ini file, there is only to enable this extension for windows only.
When I install mbstring package, then when I reload phpmyadmin page, I get blank page without any error.
I installed following packages:
apache2, php, libapache2-mod-php, php-mysql, php-mbstring, php7.0-mbstring, mysql-server, phpmyadmin
When i uninstall mbstring packages, after phpmyadmin reload I see mbstring extension error...
What to do? I spent two days to fix this but have been unsuccessful...
Thanks
After you have installed the php7.0-mbstring module, you'll need to restart apache2 for it to take effect: sudo apachectl graceful
I found the correct way (for me) to correct it... and it's fairly simple :)
Just add "universe" on the xenial-updates.
# cat /etc/apt/sources.list.d/*
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-backports main
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial main universe
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-proposed main
deb [arch=amd64] http://security.ubuntu.com/ubuntu xenial-security main
deb [arch=amd64] http://fr.archive.ubuntu.com/ubuntu/ xenial-updates main universe
to do that, just
sudo nano /etc/apt/sources.list.d/*
and then close all the windows, except the ones with xenial-updates where you add universe at the end of the line!
You could also just do this:
sudo add-apt-repository universe
On older versions of Ubuntu, you might have to add a full deb source line:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
After adding the repositories, do sudo apt-get update to update the package list.
check installed modules using;
php -m
in here you couldn't see mbstring module
Then check the php version
php -v
Then install module using following command
php5.6-mbstring
Restart the apache server
service apache2 restart
finally thats work fine.
I solve this problem from this post.
1-Install mbstring module according to your php version
$ sudo apt-get install php7.2-mbstring
2-Install libapache2-mod module according your php version
sudo apt-get install libapache2-mod-php7.2
3-Restart your apache2 services
sudo service apache2 restart
Ressource Link
I have been installing php7.0-fpm via ppa:ondrej/php on Ubuntu using the following commands without issue over the last few months whilst preparing my new server;
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php7.0-fpm
Today, I tried to install again using the same commands as above, and now I get a failure with the final command as follows;
root#10:/etc/apt/sources.list.d# apt-get install php7.0-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0-fpm
E: Couldn't find any package by regex 'php7.0-fpm'
Any clues as to why this install command set has suddenly stopped working?!
The same error is recorded when trying to install php7.0-mysql, which again was working fine until recently.
Many thanks in advance,
Dave
I have found a resolution for this as shown below.
The Ubuntu version I was using was 15.04, which is now out of support.
After upgrading my install to Ubuntu 15.10 the installation of php7.0-fpm and php7.0-mysql work as expected.
It appears that the php7.0-* packages have been removed from the Ubuntu 15.04 version of the ppa:ondrej/php repo, but are available in the 15.10 version.
Currently upgrading all my servers based on this change.
Dave
The dotdeb repository seems to be working with the 7.0 extensions for me:
https://www.dotdeb.org/instructions/
It's probably not ideal, but:
"Depending on your distribution (Jessie, Wheezy or Squeeze), add these two lines to your /etc/apt/sources.list file (you can also choose a mirror near you) :"
deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all
Then you should be able to install everything with:
sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv