How can I savely upgrade my wordpress from php 7.2 to above?

0

Hi Community,

I need a higher php version, for some pluigins. I have installed wordpress with these two instrucitons: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html How can I safely upgrade it to a highr php version :)? And which php version would you recommend? my site: http://www.darm-fit.at

nice regards sebastian

profile picture
asked 7 months ago203 views
1 Answer
0
Accepted Answer

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/
AWS
EXPERT
Mike_L
answered 7 months ago
  • Thank you very much. This is the answer I searched for :- ). Nice regards sebastian

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions