Call to undefined function simplexml_load_file()

Sneha Maheshwari picture Sneha Maheshwari · Mar 23, 2018 · Viewed 11.4k times · Source

I have php 7.0 running on my ubuntu server.

php -m command says:


[PHP Modules]
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

But still when I run my website, its log says "PHP Fatal error: Call to undefined function simplexml_load_file()"

Answer

Diego Pino picture Diego Pino · Mar 21, 2019

I had the same issue. I fixed it by installing php7.2-xml:

$ sudo apt-get install php7.2-xml
$ sudo systemctl reload apache2 

After that, SimpleXML got listed by php -m:

$ php -m | grep -i simple
SimpleXML