我正在测试PHP7,在最近的更新之后出现了一个奇怪的问题。默认情况下应该启用SimpleXML,并且我的phpinfo页面显示它是可用的:

但是,没有这些职能:
<?php
if (function_exists('simplexml_load_file')) {
echo "simpleXML functions are available.<br />\n";
} else {
echo "simpleXML functions are not available.<br />\n";
}
// result-- NOT available并且该模块未被列为已加载:
~ $ php -m
[PHP Modules]
calendar
Core
ctype
curl
...
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib有人知道有没有办法解决这个问题吗?
版本信息:
~ $ php -v
PHP 7.0.3-8+deb.sury.org~trusty+2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies发布于 2016-02-24 13:56:32
我也遇到了同样的问题,我正在使用Ubuntu15.10。
在我的例子中,为了解决这个问题,我使用Synaptic包管理器(包括SimpleXml )安装了php7.0XML包。因此,在重新启动我的Apache服务器之后,我的问题就解决了。这个包出现在Debian版本中,您可以在这里找到它:https://packages.debian.org/sid/php7.0-xml。
发布于 2016-02-24 22:34:02
对于所有使用带有ppa:ondrej/php PPA的Ubuntu的用户来说,这将解决问题:
apt install php7.0-mbstring php7.0-zip php7.0-xml
(见https://launchpad.net/~ondrej/+archive/ubuntu/php)
谢谢@Alexandre Barbosa指出这一点!
编辑20160423:
解决这一问题的一个班轮:
sudo add-apt-repository -y ppa:ondrej/php && sudo apt update && sudo apt install -y php7.0-mbstring php7.0-zip php7.0-xml(这将添加上面提到的ppa,并确保您始终拥有最新的php。我们使用řej的ppa已经将近两年了,它的工作就像魅力一样)
发布于 2016-11-29 05:11:31
Ubuntu 14.04与
PHP 7.0.13-1+deb.sury.org~trusty+1 (cli) ( NTS )
sudo apt-get install php-xml为我工作过。
https://stackoverflow.com/questions/35593521
复制相似问题