Install debian stretch with php5.6
docker-php-ext-install
is a command provided by official php images. You will find it only on those images or images based on those.
Official docker php images providing php 5.6 still exist on the docker hub:
wget -qO- https://registry.hub.docker.com/v1/repositories/php/tags | jq '.[].name' | grep -P '^"5\.6(?!\.)'
"5.6"
"5.6-alpine"
"5.6-alpine3.4"
"5.6-alpine3.7"
"5.6-alpine3.8"
"5.6-apache"
"5.6-apache-jessie"
"5.6-apache-stretch"
"5.6-cli"
"5.6-cli-alpine"
"5.6-cli-alpine3.4"
"5.6-cli-alpine3.7"
"5.6-cli-alpine3.8"
"5.6-cli-jessie"
"5.6-cli-stretch"
"5.6-fpm"
"5.6-fpm-alpine"
"5.6-fpm-alpine3.4"
"5.6-fpm-alpine3.7"
"5.6-fpm-alpine3.8"
"5.6-fpm-jessie"
"5.6-fpm-stretch"
"5.6-jessie"
"5.6-stretch"
"5.6-zts"
"5.6-zts-alpine"
"5.6-zts-alpine3.4"
"5.6-zts-alpine3.7"
"5.6-zts-alpine3.8"
"5.6-zts-jessie"
"5.6-zts-stretch"
Furthermore, those images are built on top of debian 9:
docker run --rm php:5.6 cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
and provide the docker-php-ext-install
command:
docker run --rm php:5.6 which docker-php-ext-install
/usr/local/bin/docker-php-ext-install
I suggest you use one of those official image as the base for your Dockerfile.
FROM php:5.6-fpm
RUN apt-get update \
&& apt-get -y install \
libmcrypt-dev \
mcrypt \
&& docker-php-ext-install \
bcmath \
mbstring \
mcrypt \
pdo_mysql
Debian 9: the php5 packages is not installed
The package libapache2-mod-php5.6
, php5-dev
, php5-mysql
,php5-curl
can be installed only on debian Wheezy (7) , Jessie (8) or Sid . Also the ondrej/php repository does not provide those package for debian Stretch it is only provide the php5.6
package.
The command sudo apt-get install php-dev
will install the development module for PHP7 :
dh-php libssl-dev libssl-doc php7.1-cli php7.1-common php7.1-dev php7.1-json
php7.1-opcache php7.1-readline pkg-php-tools shtool xml2
Broken dependencies while installing GD Library for php5.6 on Linode server Debian 9
On debian stretch your /etc/apt/sources.list.d/php.list
should contain only the following line :
deb https://packages.sury.org/php/ stretch main
You need to uncomment the above line (remove #
) and keep the others ppa disabled (you don't need them).
The dependency problem come from the artuful ppa when enabled. To solve your problem , open the terminal then run the following command:
rm /etc/apt/sources.list.d/*
apt install apt-transport-https lsb-release ca-certificates curl
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
curl https://packages.sury.org/php/apt.gpg | apt-key add -
apt update
apt upgrade
apt dist-upgrade
apt install php5.6
Use the update-alternatives --config php
to switch between php version.
problems install php in debian
It seems you've merged in your apt file wheezy and stretch releases of debian. Try removing the last line of your file :
deb http://http.us.debian.org/debian/ wheezy main contrib non-free
and then try an apt-get update command. Then you could try to install php7.
But be aware that if you're starting from an wheezy install, you must upgrade it to stretch before trying to install php7.0
Use Curl PhP5.6 instead of Curl PhP7
PHP5.6 and its dependency can be found on Ondřej Surý repository. PHP5.6 is already installed on your system , you can install a single package php5.6-curl
as follow:
apt 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" > /etc/apt/sources.list.d/php.list
apt update
apt install php5.6-curl
I need the curl for PhP5.6 to be used as default curl instead of PhP7.
You should add the PHP5.6 to update-alternative
, it will be used later to switch between the installed php version.
let's say the php5.6
is configured to be installed under /usr/bin/php5.6
, the configuration commands should be:
Adding PHP5.6 to update-alternatives
:
update-alternatives --install /usr/bin/php php /usr/bin/php5.6 90
Set PHP5.6 as default:
update-alternatives --set php /usr/bin/php5.6
or you can use:
update-alternatives --config php
Then select php5.6
.
The best way is to install the php5.6
and its dependency from Ondřej Surý repository , when a php5.6 update is available , it will be installed through apt
.
How to install bcmath on a debian:jessie php5.6?
Simply create a Dockerfile that will build from the image you want (the one linked above) and add the line
RUN docker-php-ext-install bcmath
Related Topics
How to Get the File Path in HTML <Input Type="File"> in PHP
Admin Product Pages Custom Field Displayed in Cart and Checkout
Laravel Middleware with Multiple Roles
Laravel Eloquent: How to Get Only Certain Columns from Joined Tables
How to Use Imagick to Merge and Mask Images
How to Sort a Multidemensional Array by an Inner Key
Get the Values of 2 HTML Input Tags Having the Same Name Using PHP
Accessing Arrays Whitout Quoting the Key
Fatal Error: Call to a Member Function Prepare() on a Non-Object In
Trying to Pass Todataurl with Over 524288 Bytes Using Input Type Text
PHP Function with Optional Parameters
How to Backup MySQL Database in PHP
Laravel Check If Collection Is Empty
Illegal Command Error Code 127 in PHP Exec Function
Why Does PHP 7.4 on Windows Aborts All Command Line Actions That Require User Input