问题更新 WordPress 从 7.2 到 8.1 的 PHP 版本(缺少 MySQL 扩展)。

huangapple go评论94阅读模式
英文:

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:

  1. Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
  2. amzn2-core | 3.7 kB 00:00:00
  3. 281 packages excluded due to repository priority protections
  4. Resolving Dependencies
  5. --> Running transaction check
  6. ---> Package php-cli.x86_64 0:7.2.34-1.amzn2 will be updated
  7. ---> Package php-cli.x86_64 0:8.1.12-1.amzn2 will be an update
  8. ---> Package php-common.x86_64 0:7.2.34-1.amzn2 will be updated
  9. --> Processing Dependency: php-common(x86-64) = 7.2.34-1.amzn2 for package: php-json-7.2.34-1.amzn2.x86_64
  10. ---> Package php-common.x86_64 0:8.1.12-1.amzn2 will be an update
  11. ---> Package php-fpm.x86_64 0:7.2.34-1.amzn2 will be updated
  12. ---> Package php-fpm.x86_64 0:8.1.12-1.amzn2 will be an update
  13. ---> Package php-gd.x86_64 0:7.2.34-1.amzn2 will be updated
  14. ---> Package php-gd.x86_64 0:8.1.12-1.amzn2 will be an update
  15. ---> Package php-mysqlnd.x86_64 0:7.2.34-1.amzn2 will be updated
  16. ---> Package php-mysqlnd.x86_64 0:8.1.12-1.amzn2 will be an update
  17. ---> Package php-pdo.x86_64 0:7.2.34-1.amzn2 will be updated
  18. ---> Package php-pdo.x86_64 0:8.1.12-1.amzn2 will be an update
  19. --> Finished Dependency Resolution
  20. Error: Package: php-json-7.2.34-1.amzn2.x86_64 (@amzn2extra-php7.2)
  21. Requires: php-common(x86-64) = 7.2.34-1.amzn2
  22. Removing: php-common-7.2.34-1.amzn2.x86_64 (@amzn2extra-php7.2)
  23. php-common(x86-64) = 7.2.34-1.amzn2
  24. Updated By: php-common-8.1.12-1.amzn2.x86_64 (amzn2extra-php8.1)
  25. php-common(x86-64) = 8.1.12-1.amzn2
  26. Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
  27. php-common(x86-64) = 5.4.16-43.amzn2
  28. Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
  29. php-common(x86-64) = 5.4.16-43.amzn2.0.1
  30. Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
  31. php-common(x86-64) = 5.4.16-43.amzn2.0.2
  32. Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
  33. php-common(x86-64) = 5.4.16-43.amzn2.0.3
  34. Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
  35. php-common(x86-64) = 5.4.16-43.amzn2.0.4
  36. Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
  37. php-common(x86-64) = 5.4.16-45.amzn2.0.5
  38. Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
  39. php-common(x86-64) = 5.4.16-45.amzn2.0.6
  40. Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
  41. php-common(x86-64) = 5.4.16-46.amzn2.0.2
  42. Available: php-common-8.1.11-1.amzn2.x86_64 (amzn2extra-php8.1)
  43. php-common(x86-64) = 8.1.11-1.amzn2
  44. You could try using --skip-broken to work around the problem
  45. 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:

  1. Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
  2. amzn2-core | 3.7 kB 00:00:00
  3. 281 packages excluded due to repository priority protections
  4. Resolving Dependencies
  5. --&gt; Running transaction check
  6. ---&gt; Package php-cli.x86_64 0:7.2.34-1.amzn2 will be updated
  7. ---&gt; Package php-cli.x86_64 0:8.1.12-1.amzn2 will be an update
  8. ---&gt; Package php-common.x86_64 0:7.2.34-1.amzn2 will be updated
  9. --&gt; Processing Dependency: php-common(x86-64) = 7.2.34-1.amzn2 for package: php-json-7.2.34-1.amzn2.x86_64
  10. ---&gt; Package php-common.x86_64 0:8.1.12-1.amzn2 will be an update
  11. ---&gt; Package php-fpm.x86_64 0:7.2.34-1.amzn2 will be updated
  12. ---&gt; Package php-fpm.x86_64 0:8.1.12-1.amzn2 will be an update
  13. ---&gt; Package php-gd.x86_64 0:7.2.34-1.amzn2 will be updated
  14. ---&gt; Package php-gd.x86_64 0:8.1.12-1.amzn2 will be an update
  15. ---&gt; Package php-mysqlnd.x86_64 0:7.2.34-1.amzn2 will be updated
  16. ---&gt; Package php-mysqlnd.x86_64 0:8.1.12-1.amzn2 will be an update
  17. ---&gt; Package php-pdo.x86_64 0:7.2.34-1.amzn2 will be updated
  18. ---&gt; Package php-pdo.x86_64 0:8.1.12-1.amzn2 will be an update
  19. --&gt; Finished Dependency Resolution
  20. Error: Package: php-json-7.2.34-1.amzn2.x86_64 (@amzn2extra-php7.2)
  21. Requires: php-common(x86-64) = 7.2.34-1.amzn2
  22. Removing: php-common-7.2.34-1.amzn2.x86_64 (@amzn2extra-php7.2)
  23. php-common(x86-64) = 7.2.34-1.amzn2
  24. Updated By: php-common-8.1.12-1.amzn2.x86_64 (amzn2extra-php8.1)
  25. php-common(x86-64) = 8.1.12-1.amzn2
  26. Available: php-common-5.4.16-43.amzn2.x86_64 (amzn2-core)
  27. php-common(x86-64) = 5.4.16-43.amzn2
  28. Available: php-common-5.4.16-43.amzn2.0.1.x86_64 (amzn2-core)
  29. php-common(x86-64) = 5.4.16-43.amzn2.0.1
  30. Available: php-common-5.4.16-43.amzn2.0.2.x86_64 (amzn2-core)
  31. php-common(x86-64) = 5.4.16-43.amzn2.0.2
  32. Available: php-common-5.4.16-43.amzn2.0.3.x86_64 (amzn2-core)
  33. php-common(x86-64) = 5.4.16-43.amzn2.0.3
  34. Available: php-common-5.4.16-43.amzn2.0.4.x86_64 (amzn2-core)
  35. php-common(x86-64) = 5.4.16-43.amzn2.0.4
  36. Available: php-common-5.4.16-45.amzn2.0.5.x86_64 (amzn2-core)
  37. php-common(x86-64) = 5.4.16-45.amzn2.0.5
  38. Available: php-common-5.4.16-45.amzn2.0.6.x86_64 (amzn2-core)
  39. php-common(x86-64) = 5.4.16-45.amzn2.0.6
  40. Available: php-common-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
  41. php-common(x86-64) = 5.4.16-46.amzn2.0.2
  42. Available: php-common-8.1.11-1.amzn2.x86_64 (amzn2extra-php8.1)
  43. php-common(x86-64) = 8.1.11-1.amzn2
  44. You could try using --skip-broken to work around the problem
  45. 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

huangapple
  • 本文由 发表于 2023年2月8日 21:10:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/75386293.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定