S
S
Sergey Pugovkin2017-08-09 15:14:06
PHP
Sergey Pugovkin, 2017-08-09 15:14:06

Installing old version of PHP (5.4) on Debian 9?

How to install php5.4 on Debian 9? There is already php7 next to it, but one old project refuses to work in it.
I want to compile php5.4 specifically for this old project (I would even say ancient). You need fpm version, because. web server - nginx.
There was a command in one instruction,
apt-get build-dep php5
but I have an error with it:
E: Unable to find a source package for php5

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Pugovkin, 2017-08-09
@Driver86

In general, I managed to compile ... it turned out to be easier than I thought)
There is no need to do any "apt-get build-dep php5". Compiled php 5.4.45 on Debian 9. Works fine.

N
Nazar Mokrinsky, 2017-08-09
@nazarpc

Use Docker and run old version of PHP in a container.

S
ShamblerR, 2019-03-12
@ShamblerR

Just checked

apt-get update
apt-get install -y libfcgi-dev libfcgi0ldbl libjpeg62-dbg libmcrypt-dev libssl-dev libxml2-dev zlib1g-dev libcurl4-gnutls-dev libjpeg-turbo8-dev libbz2-dev libjpeg-dev libfreetype6-dev libmcrypt-dev libcurl4-gnutls-dev
ln -s /usr/include/x86_64-linux-gnu/curl curl

cd /usr/local/include
mkdir /opt/php-5.4.45
mkdir /usr/local/src/php5
cd /usr/local/src/php5
wget http://de2.php.net/get/php-5.4.45.tar.gz/from/this/mirror
mv mirror php-5.4.45.tar.gz
tar -xzvf php-5.4.45.tar.gz
cd php-5.4.45
./configure --prefix=/opt/php-5.4.45 --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-mbstring --enable-sockets --enable-exif --enable-bcmath --enable-calendar --enable-zip --enable-ftp --enable-gd-native-ttf --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir --with-zlib --with-zlib-dir --with-bz2 --with-mcrypt --with-mhash --with-pcre-regex --with-libxml-dir=/usr --with-xmlrpc --with-xsl --with-mysql --with-libdir=/lib/x86_64-linux-gnu --with-curl
make
make install

/opt/php-5.4.45/bin/php -v
PHP 5.4.45 (cli) (built: Mar 12 2019 20:05:50)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question