I'm testing PHP7, and have a weird issue after a recent update. SimpleXML should be enabled by default, and my phpinfo
page shows that it is available:
However, the functions are not available:
<?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
And the module isn't listed as loaded:
~ $ php -m
[PHP Modules]
calendar
Core
ctype
curl
...
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib
Anyone know if there's a workaround for this?
Version info:
~ $ 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
I had the same problem and I'm using Ubuntu 15.10.
In my case, to solve this issue, I installed the package php7.0-xml using the Synaptic package manager, which include SimpleXml. So, after restart my Apache server, my problem was solved. This package came in the Debian version and you can find it here: https://packages.debian.org/sid/php7.0-xml.
For all those using Ubuntu with ppa:ondrej/php
PPA this will fix the problem:
apt install php7.0-mbstring php7.0-zip php7.0-xml
(see https://launchpad.net/~ondrej/+archive/ubuntu/php)
Thanks @Alexandre Barbosa for pointing this out!
EDIT 20160423:
One-liner to fix this issue:
sudo add-apt-repository -y ppa:ondrej/php && sudo apt update && sudo apt install -y php7.0-mbstring php7.0-zip php7.0-xml
(this will add the ppa noted above and will also make sure you always have the latest php. We use Ondřej's PHP ppa for almost two years now and it's working like charm)
For Ubuntu 14.04 with
PHP 7.0.13-1+deb.sury.org~trusty+1 (cli) ( NTS )
sudo apt-get install php-xml
worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With