Skip to content
Advertisement

How to update PHP versions with Yum on AWS Linux / CentOS

I have a web server with PHP 7.3 installed (And Apache + WordPress), plus a number of PHP related modules. This server is on AWS Linux.

When the AWS repo makes PHP 7.4 available, what’s the best way to upgrade the PHP 7.3 packages to 7.4 and preserve my PHP configs? I’m assuming that sudo yum upgrade isn’t going to cut it. Will I need to uninstall php73-* and then install php74-*?

By way of showing what I have:

yum list installed *php*
Loaded plugins: priorities, update-motd, upgrade-helper
Installed Packages
php73.x86_64                       7.3.17-1.25.amzn1               @amzn-updates
php73-cli.x86_64                   7.3.17-1.25.amzn1               @amzn-updates
php73-common.x86_64                7.3.17-1.25.amzn1               @amzn-updates
php73-gd.x86_64                    7.3.17-1.25.amzn1               @amzn-updates
php73-json.x86_64                  7.3.17-1.25.amzn1               @amzn-updates
php73-mbstring.x86_64              7.3.17-1.25.amzn1               @amzn-updates
php73-mysqlnd.x86_64               7.3.17-1.25.amzn1               @amzn-updates
php73-pdo.x86_64                   7.3.17-1.25.amzn1               @amzn-updates
php73-process.x86_64               7.3.17-1.25.amzn1               @amzn-updates
php73-xml.x86_64                   7.3.17-1.25.amzn1               @amzn-updates

Advertisement

Answer

To install PHP 7.4 along with all related packages (extensions) you can use Remi’s repository, it even has a setup wizard that will walk you through the process here https://rpms.remirepo.net/wizard/

But you’ll have to uninstall your current php version, what I do in these situations is just run php -m, save all the modules I have and know my web app will use and then do a yum remove php* to remove all traces but review carefully all the removed packages before accepting as it may remove other packages because of dependencies.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement