在 Amazon EC2 上安装 php-dom 扩展

Install php-dom extension on Amazon EC2

我尝试在新创建的 Amazon EC2 实例上安装 php-dom 扩展程序但未成功,但无论我尝试什么都失败了...

我尝试了以下命令(以及其他命令):

sudo yum install php-dom

sudo yum install php-xml

这是我每次得到的:

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                               | 3.7 kB     00:00     
202 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package php-xml.x86_64 0:5.4.16-46.amzn2.0.2 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-46.amzn2.0.2 for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.24)(64bit) for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.22)(64bit) for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.18)(64bit) for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.13)(64bit) for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Processing Dependency: libxslt.so.1(LIBXML2_1.0.11)(64bit) for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Processing Dependency: libxslt.so.1()(64bit) for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Processing Dependency: libexslt.so.0()(64bit) for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Running transaction check
---> Package libxslt.x86_64 0:1.1.28-5.amzn2.0.2 will be installed
---> Package php-xml.x86_64 0:5.4.16-46.amzn2.0.2 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-46.amzn2.0.2 for package: php-xml-5.4.16-46.amzn2.0.2.x86_64
--> Finished Dependency Resolution
Error: Package: php-xml-5.4.16-46.amzn2.0.2.x86_64 (amzn2-core)
           Requires: php-common(x86-64) = 5.4.16-46.amzn2.0.2
           Installed: php-common-7.3.19-1.amzn2.x86_64 (@amzn2extra-php7.3)
               php-common(x86-64) = 7.3.19-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
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

据我了解,php-xml(包括php-dom)需要包php-common version 5.4。 16(?!),但我是运行 PHP 7.3版,这可能是冲突的原因?

我对 AWS 还很陌生,对终端命令更了解,所以非常感谢您的帮助!如果您需要有关服务器的更多信息,我很乐意为您提供,我只是不知道那时有什么用...

谢谢。

如果您使用

安装了 php 7.3
sudo amazon-linux-extras install php7.3

那么使用 sudo yum install php-xml:

安装 php-xml for 7.3 应该没有任何问题
=======================================================================================================================================================================================
 Package                                Arch                                  Version                                           Repository                                        Size
=======================================================================================================================================================================================
Installing:
 php-xml                                x86_64                                7.3.19-1.amzn2                                    amzn2extra-php7.3