I'm running PHP 7.1 on CentOS 7 which was installed using Remi Repo. WordPress is informing me to update to PHP 7.4 for security reasons. How can I update the PHP version on the server running Apache/MySQL LAMP stack?
Scroll down to the Advanced settings tile and select PHP and database settings. Scroll down to Update PHP version. Select the PHP version you want to switch to and click Update.
READ FIRST -- IMPORTANT !!! Get a complete backup snapshot of your server before you complete these update steps
First thing you should do is do any core OS updates and package updates.
yum update -y
Check which version of PHP you are currently running.
php -v
Print a list to see all the PHP packages you have installed. You will need to replace all these packages in PHP 7.4. You should copy this list to a file so you can refer to it if you need to. Make a note of the version of PHP here (7x or 7-x).
rpm -qa | grep php
rpm -qa | grep php > php_rpm.txt
Remove PHP core and all the installed PHP packages.
yum remove "php*" -y
Install the updated remi repository if it is not already installed.
yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Check out a list of all available remi packages (not-required)
yum repolist remi-safe
7. Disable PHP 7.x and enable PHP 7.4 (Replace x with sub-version of your previously installed version noted above in step 3) and install any extra packages you want / need.
yum --disablerepo=remi-php7x --enablerepo=remi-php74 install php php-pdo php-fpm php-gd php-mbstring php-mysql php-curl php-mcrypt php-json -y
Check the updated PHP version.
php -v
Restart Apache to use the newly installed PHP 7.4
systemctl restart httpd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With