Install PHP 5.6 On Cyberpanel OS Almalinux 8

hallo, can help me Install PHP 5.6 On Cyberpanel OS Almalinux 8

Hello @hosteko

Install from LiteSpeed repositories e.g.

## install dependencies
$ yum -y install gcc make gcc-c++ cpp kernel-headers.x86_64 libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel libmcrypt libmcrypt-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel libtool-ltdl-devel
## https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:php:rpm#useful_php_install_commands
$ yum install lsphp56 lsphp56-mcrypt lsphp56-bcmath lsphp56-common lsphp56-dba lsphp56-dbg lsphp56-devel lsphp56-enchant lsphp56-gd lsphp56-gmp lsphp56-imap lsphp56-intl lsphp56-json lsphp56-ldap lsphp56-mbstring lsphp56-mysqlnd lsphp56-odbc lsphp56-opcache lsphp56-pdo lsphp56-pear lsphp56-pecl-apcu lsphp56-pecl-apcu-devel lsphp56-pecl-apcu-panel lsphp56-pecl-igbinary lsphp56-pecl-igbinary-devel lsphp56-pecl-mcrypt lsphp56-pecl-memcache lsphp56-pecl-memcached lsphp56-pecl-msgpack lsphp56-pecl-msgpack-devel lsphp56-pecl-redis lsphp56-pgsql lsphp56-process lsphp56-pspell lsphp56-recode lsphp56-snmp lsphp56-soap lsphp56-tidy lsphp56-xml lsphp56-xmlrpc lsphp56-zip
## OR install all php versions
$ yum groupinstall lsphp-all

To install PHP modules [TUTORIAL] How to install any PHP modules using PEAR Package Manager

PHP 5.6 was end of life almost 4 years ago.

You can install it using the method above but it would be a much better idea to migrate whatever apps that you are using that need it to something more modern that will run on a supported and secure version of PHP.

Thanks you for help

I’ve compiled php5.6 in LiteSpeed and now php5.6 is installed on my AlmaLinux 8:

# /usr/local/lsws/lsphp56/bin/php -v
PHP 5.6.40 (cli) (built: May 29 2023 08:07:30) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

But I can’t find php 5.6 in CyberPanel (version 2.3) itself. Does anybody know how to make CyberPanel find this php version?

Did you downgrade openssl to achieve this?

My Solution to get this working without downgrading openssl was to add the Centos 7 Base repo and the openlitespeed Repo for Centos 7.

Steps below:

  1. Navigate to /etc/yum.repos.d and create a new repo file e.g. CentOS-Base.repo

  2. Add the following contents to the file

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-7 - Base
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=$infra
baseurl=http://centos.mirrors.ovh.net/ftp.centos.org/7/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-7 - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=$infra
baseurl=http://centos.mirrors.ovh.net/ftp.centos.org/7/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-7 - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=$infra
baseurl=http://centos.mirrors.ovh.net/ftp.centos.org/7/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-7 - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=centosplus&infra=$infra
baseurl=http://centos.mirrors.ovh.net/ftp.centos.org/7/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[litespeed]
name=LiteSpeed Tech Repository for CentOS 7 - x86_64
baseurl=http://rpms.litespeedtech.com/centos/7/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-litespeed

[litespeed-update]
name=LiteSpeed Tech Update Repository for CentOS 7 - x86_64
baseurl=http://rpms.litespeedtech.com/centos/7/update/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-litespeed

[litespeed-edge]
name=LiteSpeed Tech Edge Repository for CentOS 7 - x86_64
baseurl=http://rpms.litespeedtech.com/edge/centos/7/x86_64/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-litespeed
  1. run: yum makecache

  2. Download the centos key from: here and place in the following path: /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

  3. run: yum install lsphp56 lsphp56-bcmath lsphp56-common lsphp56-dba lsphp56-dbg lsphp56-devel lsphp56-enchant lsphp56-gd lsphp56-gmp lsphp56-imap lsphp56-intl lsphp56-ioncube lsphp56-ldap lsphp56-mbstring lsphp56-mcrypt lsphp56-mysqlnd lsphp56-odbc lsphp56-opcache lsphp56-pdo lsphp56-pear.noarch lsphp56-pecl-igbinary lsphp56-pecl-redis lsphp56-pgsql lsphp56-process lsphp56-pspell lsphp56-recode lsphp56-soap lsphp56-tidy lsphp56-xml lsphp56-xmlrpc

  4. Remove the added repos if no longer needed

The repos will handle all the dependencies needed and Cyberpanel will automatically detect php 5.6 and add it to the sselectable dropdown list. (Tested in 2.3.5)