PHP DOMDocument 丢失
Posted
技术标签:
【中文标题】PHP DOMDocument 丢失【英文标题】:PHP DOMDocument missing 【发布时间】:2011-07-26 13:03:45 【问题描述】:运行 $dom = new DOMDocument("1.0", "utf-8"); 时遇到一个奇怪的错误: 警告:require_once(classes/DOMDocument.class.php) [function.require-once]:无法打开流:/var/www/html/cms/ 中没有这样的文件或目录bootstrap.php 第 5 行 致命错误:require_once() [function.require]: 无法打开所需的 'classes/DOMDocument. /var/www/html 中的 class.php' (include_path='.:/usr/share/pear:/usr/share/php:/var/www/html/cms/plugins/Zend/library') /cms/bootstrap.php 第 5 行
根据 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
想法??
【问题讨论】:
这里是 DOM 要求 - php.net/manual/en/dom.requirements.php。此外,PHP 5.1.6 现在已经很老了。您应该考虑升级 您的问题是包管理器,而不是 PHP。手动下载 RPM 并使用rpm --nodeps --force php-xml*.rpm
进行安装。
[user@lnxcmsdev cm]$ sudo yum --enablerepo=webtatic install libxml 设置安装过程 没有可用的软件包 libxml。无事可做
【参考方案1】:
固定为:
sudo yum --enablerepo=webtatic install php-xml
sudo /sbin/service httpd stop
sudo /sbin/service httpd start
【讨论】:
【参考方案2】:首先安装这个rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
然后安装
sudo yum --enablerepo=webtatic install php-xml
这应该 100% 有效。
【讨论】:
【参考方案3】:我有同样的问题,我在 Centos7 上安装了 php71 REMI。
我检查了这个:
yum install php-xml
但是它已经安装并且我收到了这条消息:
Package php-xml-7.1.4-1.el7.remi.x86_64 already installed and latest version
然后我尝试了这个:
yum install php71-php-xml
它错过了,所以我得到了
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
我回答是,它安装了。 然后重启httpd2.4:
service httpd restart
然后问题就解决了。
【讨论】:
以上是关于PHP DOMDocument 丢失的主要内容,如果未能解决你的问题,请参考以下文章