Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
I can't login to /wp-admin following fatal error: Uncaught Error: Call to undefined function simplexml_load_file()

Solution:
The SimpleXML extension is not active on the server. Forcing a re-install of XML solved it.

apt-get --reinstall install php7.3-xml

Check the errata link.

Relevant Documentation:
- https://wpml.org/errata/php-7-possible-issues-simplexml/
- https://stackoverflow.com/questions/49447168/call-to-undefined-function-simplexml-load-file
- https://stackoverflow.com/questions/35593521/php-7-simplexml

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 7 replies, has 3 voices.

Last updated by Dražen 4 years, 4 months ago.

Assisted by: Dražen.

Author Posts
September 24, 2020 at 8:26 am #7087829

bertieB

I can't login to /wp-admin following upgrade to php 7.3 (see error below)

Fatal error: Uncaught Error: Call to undefined function simplexml_load_file() in /var/www/xxxxxxxx/www/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/class-wp-installer.php:817 Stack trace: #0 /var/www/xxxxxxxx/www/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/class-wp-installer.php(71): WP_Installer->load_repositories_list() #1 /var/www/xxxxxxxx/www/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/class-wp-installer.php(50): WP_Installer->__construct() #2 /var/www/xxxxxxxx/www/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/functions-core.php(3): WP_Installer::instance() #3 /var/www/xxxxxxxx/www/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/installer.php(15): WP_Installer() #4 /var/www/xxxxxxxx/www/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/loader.php(164): include_once('/var/www/my_web...') #5 /var/www/xxxxxxxx/www/wp-includes/cla in /var/www/xxxxxxxx/www/wp-content/plugins/sitepress-multilingual-cms/vendor/otgs/installer/includes/class-wp-installer.php on line 817

I looked at this page
https://wpml.org/errata/php-7-possible-issues-simplexml/

But I am not on Ubuntu, I'm on Debian GNU/Linux 10 (buster)

apt-get upgrade
doesn't do anything (it's up to date)

I contacted the support of my server and ran
apt install php7.3-xml

That didn't solve the problem.

I did
# php -m
[PHP Modules]
(...)
shmop
sockets
(...)

So it looks likes simplexml is not installed.

I tried
# apt-get install php7.3-simplexml

Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php7.3-xml' instead of 'php7.3-simplexml'
php7.3-xml is already the newest version (7.3.22-1+0~20200909.67+debian10~1.gbpdd7b72).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

September 25, 2020 at 8:50 am #7097703

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

Thank you for contacting WPML support!

Before your ticket is assigned to one of my colleagues, please allow me to walk you through some initial debugging steps. This will help speed up the support process.

If you run phpinfo (hidden link) on your site root, do you see this? If not there, then SimpleXML is still not active (may require server restart) and there is nothing we can help with.

Regards,
Bruno Kos

September 25, 2020 at 12:58 pm #7099755

bertieB

Hi Bruno,

I created a php file

And SimpleXML appears twice

Module Authors
SimpleXML Sterling Hughes, Marcus Boerger, Rob Richards

Additional .ini files parsed
/etc/php/7.3/fpm/conf.d/20-shmop.ini, /etc/php/7.3/fpm/conf.d/20-simplexml.ini, /etc/php/7.3/fpm/conf.d/20-sockets.ini, (...)

you can view the file here
hidden link

I hope we can fix it as I have a webinar in a couple weeks with Saleforce and many French NGOs so the French version is important.
Of course, I could still move my site back to Bluehost but I love my Greenhost wind powered vps!

Thanks,

Bertie

September 28, 2020 at 12:37 pm #7114861

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello Bertie,

thanks for getting back.

Sorry for waiting, we have a higher queue these days.

Sometimes phpinfo can show SimpleXML enabled even if it is not working correctly or set up and running on the server. Typically on Debian systems, you have different PHP configuration for CLI and for PHP running as say an Apache module. Your phpinfo page may very well show SimpleXML as being enabled via web server, while it is not enabled via CLI.

To check if the module is enabled and running you can try creating a new PHP file with the next code and opening it. If you have SimpleXML enabled you will get the next message: ""SimpleXML functions are available.".

<?php

if (function_exists('simplexml_load_file')) {
    echo "simpleXML functions are available.<br />\n";
} else {
    echo "simpleXML functions are not available.<br />\n";
}

What can I suggest is:

- try installing another version, for example, php7.2-xml

- Contact you hosting support and make sure SimpleXML is installed, enabled working as excepted

- Please check the next StackOverflow pages for a possible solution:

- https://stackoverflow.com/questions/49447168/call-to-undefined-function-simplexml-load-file
- https://stackoverflow.com/questions/35593521/php-7-simplexml

Please let me know how it goes.

Kind regards,
Drazen

October 1, 2020 at 7:25 am #7140993

bertieB

Hi,
I created the php file and it returns
simpleXML functions are not available.
So I tried the solutions you suggested but on VPS I can't choose which php version is associated with WordPress. It has to be 7.3.
The hosting is on on Debian 10 (buster) but can't find any info about installing simpleXML on this version.
For now, my only option seems to be to move my website to a different host.
Unless you can think of something.
Thanks

October 1, 2020 at 1:43 pm #7144111

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for the feedback.

Yes, that then means SimpleXML is not activated, which is required for WPML to work correctly:

- https://wpml.org/home/minimum-requirements/

I am sorry that I could not provide any more help, but this is an issue up to the hosting/server.
This could cause issues with some other WP plugins also not only WPML.

I tried my best to propose solutions that worked for other users, but unfortunately, they seem to not work for you. I can only suggest to try on another hosting or other proposed solution from Stackoverflow.

Hope you understand.

Kind regards,
Drazen

October 4, 2020 at 9:46 am #7159375

bertieB

For info, and to close the ticket.
Forcing a re-install of xml solved the issue

apt-get --reinstall install php7.3-xml

October 5, 2020 at 6:14 am #7161947

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Great! 🙂

Glad to hear your issue is now solved.

I will be closing this ticket and marking it as resolved.

I hope I was helpful. Don't hesitate to ask if you find any problem in the future, I'll gladly help you.

Regards,
Drazen