Upgrade PHP 7.0 to 7.4 on Centos 7

If you're using php 7.0 that was installed on your Centos 7 with auto-install script and wish to upgrade to PHP 7.4 (as 7.0 is no longer supported) 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 php70u-common php70u-fpm php70u-cli php70u-mcrypt php70u-gd php70u-json php70u-imap php70u-snmp php70u-soap php70u-xml php70u-process php70u-mbstring php70u-pdo php70u-mysqlnd php70u-ldap    php70u-pecl-memcached
 
 
rpm -Uvh --force https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh --force https://repo.ius.io/ius-release-el7.rpm
 
yum -y install php74-fpm php74-cli php74-mcrypt php74-gd php74-json php74-imap php74-snmp php74-soap php74-sodium php74-xml php74-process php74-mbstring php74-pdo php74-mysqlnd php74-ldap    php74-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_7.4.so /usr/lib64/php/modules/
chmod +x /usr/lib64/php/modules/ioncube_loader_lin_7.4.so
echo "zend_extension=ioncube_loader_lin_7.4.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