- Newest
- Most votes
- Most comments
Amazon Linux 2 (AL 2) will EOL (end-of-life) June 2025, so you may want to use Amazon Linux 2023 which will EOL 2028
You can use amazon-linux-extras to install PHP 8.1 or PHP 8.2. Something like below. You will need to run the commands as root
amazon-linux-extras enable php8.2
yum clean metadata
yum install -q -y php-{cli,fpm,opcache}
yum install -q -y php-{mysqlnd,pgsql,pdo,dba}
yum install -q -y php-{xml,soap,ldap,intl}
yum install -q -y php-{mbstring,bcmath,gd,enchant,pspell,tidy}
You will need to remove existing PHP versions first.
I would suggest latest PHP version 8.2 due to long EOL date Note that you will need to compile/install other PHP extensions such as php-redis and php-imagick yourself.
Alternatively, you can also use ec2-lamp-server CloudFormation template, to provision a new EC2 AL2 or AL2023 LEMP instance with additional PHP extensions, and install WordPress, and migrate your website.
Here are my WordPress on AL2023 install notes for your reference with Nginx and MariaDB
MariaDB (root password not needed as this is named pipes)
sudo mysql -uroot -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER wordpress@localhost IDENTIFIED BY 'yourpassword';
GRANT ALL on wordpress.* to wordpress@localhost;
quit
Create DNS entry, run certbot
sudo certbot --nginx
WordPress install files on Nginx
cd /tmp/
wget https://wordpress.org/latest.zip
unzip -q latest.zip
sudo cp -R wordpress/* /usr/share/nginx/html/
sudo chown -R apache:apache /usr/share/nginx/html/
Relevant content
- asked 6 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 21 days ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 4 months ago
Thank you very much. This is the answer I searched for :- ). Nice regards sebastian