Downgrade to PHP 5.4.45 in Phusion Docker - php

I'm running a dev environment using Docker and https://github.com/phusion/baseimage-docker.
I've tried installing PHP 5.4.45 on it, but I always get a PHP 5.5.9 version when running apt-cache policy php5.
Every guide uses sudo add-apt-repository ppa:ondrej/php5-oldstable, which I installed but it doesn't work..any ideas?
This is one of the guides I tried: https://www.dev-metal.com/how-to-install-latest-php-5-4-x-on-ubuntu-12-04-lts-precise-pangolin/

So the phusion:baseimage:latest will (at the moment) use Ubuntu 16.04.
The PHP 5.4 repository will only work with Ubuntu 12.04.
This is how I got it working:
1: Start a container based on Phusion 0.9.9 (which is based on Ubuntu 12.04):
docker run phusion/baseimage:0.9.9
2: Lookup the name of the container and enter it
3: run following commands:
apt-get update && apt-get install -y python-software-properties software-properties-common
export LC_ALL=en_US.UTF-8
add-apt-repository ppa:ondrej/php5-oldstable
apt-get update
apt-cache policy php5
4: output will be:
php5:
Installed: (none)
Candidate: 5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1
Version table:
5.4.45-4+deprecated+dontuse+deb.sury.org~precise+1 0
500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
5.3.10-1ubuntu3.25 0
500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
5.3.10-1ubuntu3 0
500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

Related

Debian 8 Jessie and PHP > 7.2

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

Unable to install php-5 phalcon for ubuntu 16.04

My machine is running on ubuntu 16.04 and I have installed php 5.6, but when I am trying to run to install php5-phalcon, it returns error that package not found.
Following is command that I ran
sudo apt-get install php5-phalcon
It returns following output
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-phalcon
You need to add the correct repository in first...
curl -s "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | sudo bash
sudo apt-get install php5-phalcon
# Ubuntu 16.04+, Debian 9+
sudo apt-get install php7.0-phalcon
(From https://phalconphp.com/en/download/linux)
After trying few methods, found that php5.6-phalcon is not available for ubuntu 16.04, following are steps to install php7.0-phalcon :
curl -s "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | sudo bash
# Ubuntu 16.04+, Debian 9+
sudo apt-get install php7.0-phalcon

Unable to install php5-fpm on ubuntu 16.04 digital ocean droplet

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.

Ubuntu Server Installing PHP 7 WITHOUT Apache

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

Ubuntu 12.04 + PHP 5.6 + Memcached = How to resolve dependencies?

simple question.
I'm trying to install php + memcached on ubuntu.
First, i do this:
$ sudo add-apt-repository ppa:ondrej/php5-5.6 # Good
$ sudo apt-get update # Good
$ sudo apt-get upgrade -y # Good
$ sudo apt-get install php5 -y # Good
$ sudo apt-get install php5-fpm -y # Good
But then:
$ sudo apt-get install php5-memcached -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php5-memcached : Depends: php5-common (= 5.3.29-1~dotdeb.0) but 5.6.9+dfsg-1+deb.sury.org~precise+2 is to be installed
E: Unable to correct problems, you have held broken packages.
Some info about server:
$ cat /etc/*-release | grep PRETTY
PRETTY_NAME="Ubuntu precise (12.04.5 LTS)"
$ php -v | grep PHP
PHP 5.6.9-1+deb.sury.org~precise+2 (cli) (built: May 26 2015 15:13:29)
$ php5-fpm -v | grep PHP
PHP 5.6.9-1+deb.sury.org~precise+2 (fpm-fcgi) (built: May 26 2015 15:38:14)
$ apt-cache policy php5-common
php5-common:
Installed: 5.6.9+dfsg-1+deb.sury.org~precise+2
How can i resolve this and install memcached extension on 5.6?
I'm also try to install from PECL, but
$ pecl install memcache
pecl/memcache is already installed and is the same as the released version 2.2.7
install failed
Thank you!
I have solved for myself this problem with Ondřej Surý repo and aptitude.
I have php 5.5.9 (Ubuntu 14.04). It was message
The following packages have unmet dependencies:
php5-memcached : Depends: php5-common (= 5.3.29-1~dotdeb.0) but 5.5.9+dfsg-1ubuntu4.9 is to be installed
I added Ondrej repo:
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
And then install php5-memcache and php5-memcached by:
sudo aptitude install php5-memcached
and press "n" several times, when aptitude offered old php version. After about 5 times aptitude said:
Next actions will solved depends:
Install next packets:
1) php5-memcached [2.1.0-6build1 (trusty)]
Accept this solution? [Y/n/q/?]
And press Y.

Categories