PHP DOMDocument 丢失

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5494317/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 21:37:24  来源:igfitidea点击:

PHP DOMDocument missing

phpdomdocumentrequire

提问by

I am getting an odd error when running $dom = new DOMDocument("1.0", "utf-8");: Warning: require_once(classes/DOMDocument.class.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/html/cms/bootstrap.phpon line 5

Fatal error: require_once() [function.require]: Failed opening required 'classes/DOMDocument.class.php' (include_path='.:/usr/share/pear:/usr/share/php:/var/www/html/cms/plugins/Zend/library') in /var/www/html/cms/bootstrap.phpon line 5

运行 $dom = new DOMDocument("1.0", "utf-8"); 时出现奇怪的错误: 警告:require_once(classes/DOMDocument.class.php) [function.require-once]:无法打开流:第5行的/var/www/html/cms/bootstrap.php 中没有这样的文件或目录致命错误:require_once() [function.require]:无法打开所需的 'classes/DOMDocument.class.php' (include_path=' .:/usr/share/pear:/usr/share/php:/var/www/html/cms/plugins/Zend/library') 在/var/www/html/cms/bootstrap.php5


According to php.net/manual/en/dom.setup.php, I need php-xml installed. I have tried this but it also errors out...

根据php.net/manual/en/dom.setup.php,我需要安装php-xml。我试过这个,但它也出错了......

[user@lnxcmsdev cms]$ sudo yum install php-xml
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.web-ster.com
 * base: mirror.hmc.edu
 * extras: mirror.hmc.edu
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.rocketinternet.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-xml.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php-xml
--> Finished Dependency Resolution
php-xml-5.1.6-27.el5_5.3.i386 from updates has depsolving problems
  --> Missing Dependency: php-common = 5.1.6-27.el5_5.3 is needed by package php-xml-5.1.6-27.el5_5.3.i386 (updates)
Error: Missing Dependency: php-common = 5.1.6-27.el5_5.3 is needed by package php-xml-5.1.6-27.el5_5.3.i386 (updates)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.
[user@lnxcmsdev cms]$ sudo yum install php-common
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.web-ster.com
 * base: mirror.hmc.edu
 * extras: mirror.hmc.edu
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirror.rocketinternet.net
Setting up Install Process
Package matching php-common-5.1.6-27.el5_5.3.i386 already installed. Checking for update.
Nothing to do

Ideas??

想法??

回答by

Fixed with:

固定:

sudo yum --enablerepo=webtatic install php-xml
sudo /sbin/service httpd stop
sudo /sbin/service httpd start

回答by Boopathi Raja K

First Install this rpm

首先安装这个rpm

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

Then install

然后安装

sudo yum --enablerepo=webtatic install php-xml

须藤 yum --enablerepo=webtatic 安装 php-xml

This should 100% works.

这应该 100% 有效。

回答by Mohammad Eghlima

I had same issue, I have php71 REMI installed on Centos7.

我有同样的问题,我在 Centos7 上安装了 php71 REMI。

I checked this:

我检查了这个:

yum install php-xml

But It was installed and I got this message:

但它已安装,我收到此消息:

Package php-xml-7.1.4-1.el7.remi.x86_64 already installed and latest version

Then I tried this one:

然后我尝试了这个:

yum install php71-php-xml

And It was missed, So I got

它被错过了,所以我得到了

Dependencies Resolved

=====================================
 Package                    Arch                Version                        Repository         Size
=====================================
Installing:
 php71-php-xml              x86_64              7.1.4-1.el7.remi               remi              164 k

Transaction Summary
=====================================
Install  1 Package

I answered yes and It installed. Then restart the httpd2.4:

我回答是,它安装了。然后重启httpd2.4:

service httpd restart

Then the problem was fixed.

然后问题就解决了。