[[+content_image]]
V
V
vaniakinos12021-07-21 02:42:49
linux
vaniakinos1, 2021-07-21 02:42:49

How to install PHP 5.4 CentOS 7?

There is such a problem, I rented a server, it costs

[[email protected] ~]# php -v
PHP 7.4.19 (cli) (built: May 20 2021 05:25:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with the ionCube PHP Loader + ionCube24 v10.4.3, Copyright (c) 2002-2020, by                     ionCube Ltd.
    with Zend OPcache v7.4.19, Copyright (c), by Zend Technologies


But for the script to work correctly, I need to have php5.4 on the server and ioncube

tried many different instructions, but could not install exactly php 5.4, how can I do this?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
SagePtr, 2021-07-21
@SagePtr

Through docker, for example, run it in a container, forward the necessary folders with scripts there.
As a result, even if they break this junk through a vulnerability, they will not crawl beyond the forwarded folders.

C
CityCat4, 2021-07-21
@CityCat4

Well, there are two options.
- Look for turnips from 5.4. In fact, there are a lot of raps for a centos, and although most of them are fan-made, 5.4 is probably there
- Collect it yourself. Find a package for el6, rip out a spec from it to see the build parameters, or even build it "as I see it myself". Here, the truth is that you need to be more careful with the installation, put it in / usr / local, so that the system one does not warp

V
Victor Taran, 2021-07-21
@shambler81

there are no repositories, install from tarballs in php + fpm mode, this is the easiest way to do this.
This is how I installed it on debian, you need to correct it taking into account centos.

apt-get install -y libxslt-dev libcurl4-gnutls-dev libfcgi-dev libfcgi0ldbl 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
apt-get install -y libpq-dev
cd /usr/include
cd /usr/local/include
sudo ln -s /usr/include/x86_64-linux-gnu/curl curl
mkdir /opt/php5.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/php5.4.45 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--with-libdir=/lib/x86_64-linux-gnu \
--enable-ftp \
--with-kerberos \
--with-gettext \
--enable-fpm
make
make install

cp /usr/local/src/php5/php-5.4.45/php.ini-production /opt/php5.4.45/lib/php.ini
cp /opt/php5.4.45/etc/php-fpm.conf.default /opt/php5.4.45/etc/php-fpm.conf


sed -i 's/listen = 127.0.0.1:9000/listen = 127.0.0.1:8998/g' /opt/php5.4.45/etc/php-fpm.conf
sed -i 's/\x3Bpid = run\/php-fpm.pid/pid = run\/php-fpm.pid/g' /opt/php5.4.45/etc/php-fpm.conf
echo "include=/opt/php5.4.45/etc/pool.d/*.conf" >> /opt/php5.4.45/etc/php-fpm.conf

mkdir /opt/php5.4.45/etc/pool.d
vim /etc/init.d/php5.4.45-fpm  # вставляем конфиг, и правим версию пхп https://www.howtoforge.com/how-to-use-multiple-php-versions-php-fpm-and-fastcgi-with-ispconfig-3-ubuntu-12.10-p3
chmod 755 /etc/init.d/php5.4.45-fpm
#заменяем актуальной версией php,  плс название в общем стиле а не как по ману
sed -i 's/php\-5\.4\.12/php5.4.45/g' /etc/init.d/php5.4.45-fpm

update-rc.d php5.4.45-fpm defaults 
/etc/init.d/php5.4.45-fpm start
update-rc.d php7.3-fpm defaults
apt-get install libmemcached-dev

# исправит проблему подключения по loalhost поскольку в  стандартных php.ini она вообще не обьявлена
echo "mysqli.default_socket = /var/run/mysqld/mysqld.sock" >> /opt/php5.4.45/lib/php.ini
echo "mysqli.default_socket = /var/run/mysqld/mysqld.sock" >> /opt/php5.4.45/lib/php.ini
/etc/init.d/php5.4.45-fpm restart
/etc/init.d/apache2 restart

A
Alexey Dmitriev, 2021-07-21
@SignFinder

1. Do not ask questions on the forum, but go google.
2. Google "how to install php 5.4 on Centos 7"
3. Find the remi repo, connect and install. It is possible in parallel with the current one, it is possible instead.
https://rpms.remirepo.net/wizard/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question