英文:
Issue updating PHP version to 8.1 from 7.2 for WordPress (MySQL extension missing)
问题
I have set up a LAMP server on AWS EC2 using Amazon Linux 2 AMI for WordPress hosting. The system was working fine already, but the WordPress dashboard prompted me to update the PHP version, since I was running the outdated 7.2.34. WordPress recommended I update to 7.4. I started the process following this guide (https://greggborodaty.com/amazon-linux-2-upgrading-from-php-7-2-to-php-7-4/)
When I checked the versions available in Amazon using sudo amazon-linux-extras | grep php
The only newer versions available were 8.0 and 8.1. Upon doing some research, I figured 8.1 is the best choice to go (it is a stable release).
What was supposed to be a 15 min update turned out to be a 4-hour debacle and I somehow got PHP 8.1 installed, but the Apache server was still using 7.2, which I checked using php -v
and accessing the test.php page via a browser. I made sure to do all the necessary service restarts/reboots, but I figured the configuration file of Apache is somehow still pointing to the 7.2 version. I dropped it for the night and decided to continue the next day.
After SSH-ing to my instance this morning, the PHP version was 8.1.15 on the php test site, but the php -v
command still shows 7.2.
WordPress is no longer accessible saying: "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." and there are 6 updates available on my instance. When I run sudo yum update
I get the following output:
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
281 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package php-cli.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-cli.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-common.x86_64 0:7.2.34-1.amzn2 will be updated
--> Processing Dependency: php-common(x86-64) = 7.2.34-1.amzn2 for package: php-json-7.2.34-1.amzn2.x86_64
---> Package php-common.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-fpm.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-fpm.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-gd.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-gd.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-mysqlnd.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-mysqlnd.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-pdo.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-pdo.x86_64 0:8.1.12-1.amzn2 will be an update
--> Finished Dependency Resolution
Error: Package: php-json-7.2.34-1.amzn2.x86_64 (@amzn2extra-php7.2)
Requires: php-common(x86-64) = 7.2.34-1.amzn2
Removing: php-common-7.2.34-1.amzn2.x86_64 (@amzn2extra-php7.2)
php-common(x86-64) = 7.2.34-1.amzn2
Updated By: php-common-8.1.12-1.amzn2.x86_64 (amzn2extra-php8.1)
php-common(x86-64) = 8.1.12-1.amzn2
Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2
Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2.0.1
Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2.0.2
Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2.0.3
Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2.0.4
Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-45.amzn2.0.5
Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-45.amzn2.0.6
Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-46.amzn2.0.2
Available: php-common-8.1.11-1.amzn2.x86_64 (amzn2extra-php8.1)
php-common(x86-64) = 8.1.11-1.amzn2
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I'm obviously a newbie and could be missing something obvious. Any help is greatly appreciated <3
I tried the --skip-broken
addition, which skipped the vital updates and
英文:
I have set up a LAMP server on AWS EC2 using Amazon Linux 2 AMI for WordPress hosting. The system was working fine already, but the WordPress dashboard prompted me to update the PHP version, since I was running the outdated 7.2.34. WordPress recommended I update to 7.4. I started the process following this guide (https://greggborodaty.com/amazon-linux-2-upgrading-from-php-7-2-to-php-7-4/)
When I checked the versions available in Amazon using
sudo amazon-linux-extras | grep php
The only newer versions available were 8.0 and 8.1. Upon doing some research, I figured 8.1 is the best choice to go (it is a stable release).
What was supposed to be a 15 min update turned out to be a 4-hour debacle and I somehow got PHP 8.1 installed, but the Apache server was still using 7.2, which I checked using php -v
and accessing the test.php page via a browser. I made sure to do all the necessary service restarts/reboots, but I figured the configuration file of Apache is somehow still pointing to the 7.2 version. I dropped it for the night and decided to continue the next day.
After SSH-ing to my instance this morning, the PHP version was 8.1.15 on the php test site, but the php -v
command still shows 7.2.
WordPress is no longer accessible saying: "Your PHP installation appears to be missing the MySQL extension which is required by WordPress." and there are 6 updates available on my instance. When I run sudo yum update
I get the following output:
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
281 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package php-cli.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-cli.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-common.x86_64 0:7.2.34-1.amzn2 will be updated
--> Processing Dependency: php-common(x86-64) = 7.2.34-1.amzn2 for package: php-json-7.2.34-1.amzn2.x86_64
---> Package php-common.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-fpm.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-fpm.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-gd.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-gd.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-mysqlnd.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-mysqlnd.x86_64 0:8.1.12-1.amzn2 will be an update
---> Package php-pdo.x86_64 0:7.2.34-1.amzn2 will be updated
---> Package php-pdo.x86_64 0:8.1.12-1.amzn2 will be an update
--> Finished Dependency Resolution
Error: Package: php-json-7.2.34-1.amzn2.x86_64 (@amzn2extra-php7.2)
Requires: php-common(x86-64) = 7.2.34-1.amzn2
Removing: php-common-7.2.34-1.amzn2.x86_64 (@amzn2extra-php7.2)
php-common(x86-64) = 7.2.34-1.amzn2
Updated By: php-common-8.1.12-1.amzn2.x86_64 (amzn2extra-php8.1)
php-common(x86-64) = 8.1.12-1.amzn2
Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2
Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2.0.1
Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2.0.2
Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2.0.3
Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-43.amzn2.0.4
Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-45.amzn2.0.5
Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-45.amzn2.0.6
Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
php-common(x86-64) = 5.4.16-46.amzn2.0.2
Available: php-common-8.1.11-1.amzn2.x86_64 (amzn2extra-php8.1)
php-common(x86-64) = 8.1.11-1.amzn2
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I'm obviously a newbie and could be missing something obvious. Any help is greatly appreciated <3
I tried the --skip-broken
addition, which skipped the vital updates and did not fix the issue.
I made sure that the php.ini file, which shows up in the test.php site is correctly configured as per this guide:
https://wpbuffs.com/php-installation-missing-mysql-extension-required-by-wordpress/
答案1
得分: 2
尝试手动删除该软件包。
sudo yum remove php-json-7.2.34-1.amzn2.x86_64
英文:
Try manually removing the package.
sudo yum remove php-json-7.2.34-1.amzn2.x86_64
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论