Install PHP 5.6 on AlmaLinux 8

To install PHP 5.6 on AlmaLinux 8, first enable the epel repository.

dnf install -y epel-release

install remi repository with the command

dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm

Now you can install PHP 5.6 with

dnf install php56

You can execute PHP with the command

php56

If you want PHP 5.6 to work with the command “php”, then edit

vi ~/.bashrc

At end of the file, add

source /opt/remi/php56/enable

Log off and login to the server or run command

source /opt/remi/php56/enable

Or you can create a symlink

ln -s /opt/remi/php56/root/usr/bin/php /usr/bin/php

If you need PHP work with Apache, run install Apache with

dnf install httpd

Install php-fpm with

dnf install php56-php-fpm

Enable and restart Apache

systemctl enable php56-php-fpm
systemctl enable httpd
systemctl restart httpd
systemctl restart php56-php-fpm

php-fpm pool config file available at

/etc/opt/remi/php56/php-fpm.d/www.conf
Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *