Hello everyone, and welcome to another episode of Continuous Improvement, the podcast where we explore different solutions to common problems in the tech world. I’m your host, Victor. In today’s episode, we’ll be talking about a common issue that many of us face when setting up an Amazon Linux 2 AMI server and trying to install PHP.

And we’re back. So, imagine this: you’ve just launched a brand new Amazon Linux 2 AMI server, and you’re excited to get started. But as you try to install PHP using the usual command yum install php, there seems to be a problem. The version it installs is PHP 5.4.16, and you realize that the latest version is PHP 7.2. What do you do?

Well, fear not! There is a solution to this dilemma. You can enable PHP 7.2 via Amazon Linux Extras. Let me walk you through it.

First, open up your terminal and run the following command with sudo privileges:

sudo amazon-linux-extras enable php7.2

This command will enable PHP 7.2 through the Amazon Linux Extras. Once it’s enabled, we can proceed with the installation.

But hold on, there’s one more step before we install PHP 7.2. We need to clean the metadata. Run the following command:

yum clean metadata

This will ensure that we have the most up-to-date information for the installation process. Now, we can finally install PHP 7.2 along with some additional packages that we’ll need. Run this command:

yum install php-cli php-pdo php-fpm php-json php-mysqlnd

And that’s it! You’ve successfully installed PHP 7.2 on your Amazon Linux 2 AMI server. To double-check, run php -v in your terminal, and you should see something like this:

PHP 7.2.28 (cli) (built: Mar 2 2020 19:38:11) ( NTS )

And there you have it, a step-by-step solution to upgrade your PHP version on an Amazon Linux 2 AMI server. Remember, keeping your software up to date is essential for security and performance reasons.

Thank you for tuning in to this episode of Continuous Improvement. If you found this information helpful, please consider subscribing to our podcast and leaving us a review. If you have any suggestions for future topics or questions, feel free to reach out to us on our website or social media channels.

Until next time, I’m Victor, your host, signing off.