PHP Fatal error: Uncaught Error: Call to undefined function xml_parser_create()

I’ve recently upgraded this WordPress site to PHP7, along with Ubuntu 16. When logging in today, I received an error 500.

Looking through the /var/log/apache2/error.log I found

[Wed Sep 07 21:25:43.730755 2016] [:error] [pid 710] [client 84.247.81.102:43280] PHP Fatal error:  Uncaught Error: Call to undefined function xml_parser_create() in /var/www/tecfused.com/public_html/w               p-includes/class-IXR.php:264\nStack trace:\n#0 /var/www/tecfused.com/public_html/wp-includes/class-IXR.php(464): IXR_Message->parse()\n#1 /var/www/tecfused.com/public_html/wp-includes/class-IXR.php(432               ): IXR_Server->serve('<?xml version="...')\n#2 /var/www/tecfused.com/public_html/wp-includes/class-IXR.php(440): IXR_Server->__construct(Array, false, false)\n#3 /var/www/tecfused.com/public_html/wp-in               cludes/class-wp-xmlrpc-server.php(197): IXR_Server->IXR_Server(Array)\n#4 /var/www/tecfused.com/public_html/xmlrpc.php(84): wp_xmlrpc_server->serve_request()\n#5 {main}\n  thrown in /var/www/tecfused.c               om/public_html/wp-includes/class-IXR.php on line 264

This is because the XML module is missing. you can check this by typing php -m from the command line:

root@tecfused:~# php -m
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib

To fix this, type the following:

apt-get install php7.0-xml

Then

service apache2 restart

Your WordPress site should now be working. You can check your modules to make sure.

root@tecfused:~# php -m
[PHP Modules]
calendar
Core
ctype
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
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
zlib

2 thoughts on “PHP Fatal error: Uncaught Error: Call to undefined function xml_parser_create()”

  1. Wanted to say thanks, this helped fix my issue! In my case I had php7.0-xml “installed”, but it wasn’t showing up under my php modules, so a sudo apt-get purge php7.0-xml && sudo apt-get install php7.0-xml ended up being the fix.

Leave a Reply