Upgrade PHP 7.4 to 8.1 on Centos 8

If you're using php 7.4 that was installed on your Centos 8 with auto-install script and wish to upgrade to PHP 8.1  you can do this by following steps below:



1. Login to your HostBill server as root. Ensure to disable crontab for HostBill, by adding # (comment) in front of each line in crontab:

crontab -e -u hostbill

2. Kill existing background queue process

ps auxf | grep queue | grep master   #find master process PID 
kill {PID}  #use PID from command above

3. Run following commands to remove previous php, install newer one and copy over previous fpm-config

systemctl stop php-fpm
cp /etc/php-fpm.conf /root/
cp /etc/php-fpm.d/www.conf /root/
 
yum remove php-fpm php-cli php-*
dnf module reset php
dnf -y module install php:remi-8.1
 
dnf -y install php-fpm php-cli php-json php-sodium php-xml php-bcmath php-gd php-imap php-snmp php-soap php-xml php-process php-mbstring php-pdo php-mysqlnd php-ldap    php-pecl-memcached
 
 
cd /root/
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.zip -O /root/ioncube.zip
unzip -o ioncube.zip
cp /root/ioncube/ioncube_loader_lin_8.1.so /usr/lib64/php/modules/
chmod +x /usr/lib64/php/modules/ioncube_loader_lin_8.1.so
echo "zend_extension=ioncube_loader_lin_8.1.so" > /etc/php.d/10-ioncube.ini
 
cp -f /root/php-fpm.conf /etc/php-fpm.conf
cp -f /root/www.conf /etc/php-fpm.d/www.conf
 
systemctl start php-fpm
systemctl enable php-fpm

4. Re-enable crontab entries for HostBill, by removing comment # from crontab (added in step 1):

crontab -e -u hostbill