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
已提问 8 个月前233 查看次数
1 回答
0
已接受的回答

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
专家
Mike_L
已回答 8 个月前
  • Thank you very much. This is the answer I searched for :- ). Nice regards sebastian

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则