Resolved
Overview of the issue
During the WPML installation on Ubuntu Server version 15.10 or earlier and servers with CentOS, a fatal error like Call to undefined function simplexml_load_file(...
is thrown.
Please note that if you encounter this same error when using some other server operating system, it could still be the same cause.
This happens in the next scenario:
- Install or update to Ubuntu 15.10 (or earlier) or CentOS.
- Run the
apt-get upgrade
command. - Create a website with WPML.
Workaround
There are two workarounds for this issue:
- Install the package php7.0-xml using the Synaptic package manager, which includes SimpleXml.
- If you are using Ubuntu with ppa: ondrej/php PPA run the following command from the terminal:
sudo add-apt-repository -y ppa:ondrej/php && sudo apt update && apt install -y php7.0-mbstring php7.0-zip php7.0-xml
If you are using an even more recent version of PHP, replace all occurrences of 7.0 with the installed version of PHP (e.g.sudo add-apt-repository -y ppa:ondrej/php && sudo apt update && apt install -y php7.1-mbstring php7.1-zip php7.1-xml
).
After restarting Apache, the issue should be solved.
Source: Stackoverflow: PHP 7 simpleXML
We have noticed that in some versions of Ubuntu (e.g. Ubuntu 15.10) the simplexml extension is not installed.
It seems like the lack of the extension might be an oversight from the repositories maintainers, which can be fixed by manually installing the extension.
Also, the issue doesn’t happen with all version of Ubuntu, which seems to have the references to the extensions.
Thank you. This worked for me.
Sometimes You must restart (if You have in Your PHP instalation) an FPM, in my situation: service php7.1-fpm restart
Without this restart, I have a “Call to undefined function simplexml_load_file” although php7.1-xml was correctly installed and enabled (… from phpinfo() )
Hello Wojtek,
Thank you for the additional information!
Amazing! Life saver!
This did not work for me 🙁 nor did restarting php. HELP!
Hello Jesse,
Can you please post a support request in our forum, where you’ll be able to get a better support and share more details which can’t be shared here?
Thanks,
Andrea
Woooow, work for me!
Thank you very much!
Pay attention to which PHP version you’re running. If like me you’re on 7.1, make sure to change the version references in the command from 7.0 to 7.1, restart, then enjoy!
Thank you, Mark, for pointing this out!
I’ve updated the errata with the additional information, to make sure your comment does not get unnoticed.
Hi,
when I activate WPML Multilingual CMS my website does not load and Physical Memory Usage on server suddenly full
how can I fix
this erorr which WordPress emailed me
===================
یک خطا از نوع E_ERROR در خط 133 از پرونده /home/r18i1802oox1/public_html/wp-content/themes/houzez/framework/vc_extend.php رخ داد. پیام خطا: Uncaught Error: Call to undefined function vc_map() in /home/r18i1802oox1/public_html/wp-content/themes/houzez/framework/vc_extend.php:133
Stack trace:
#0 /home/r18i1802oox1/public_html/wp-content/themes/houzez/functions.php(142): require_once()
#1 /home/r18i1802oox1/public_html/wp-includes/class-wp-hook.php(286): houzez_include_composer(”)
#2 /home/r18i1802oox1/public_html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#3 /home/r18i1802oox1/public_html/wp-includes/plugin.php(465): WP_Hook->do_action(Array)
#4 /home/r18i1802oox1/public_html/wp-settings.php(525): do_action(‘init’)
#5 /home/r18i1802oox1/public_html/wp-config.php(102): require_once(‘/home/r18i1802o…’)
#6 /home/r18i1802oox1/public_html/wp-load.php(37): require_once(‘/home/r18i1802o…’)
#7 /home/r18i1802oox1/public_html/wp-admin/admin.php(34): require_once(‘/home/r18i1802o…’)
#8 /home/r18i1802oox1/public_html/wp-admin/index.php(10): require_once(‘/home/r18i1802o…’)
#9 {main}
thrown
Hello!
Please contact our support forum (https://wpml.org/forums/forum/english-support/) as the issue you are reporting is unrelated to SimpleXML and requires some additional detail.
Thanks!
You also need to make sure you have the corresponding extension
In your php.ini add/uncomment to following: extension=php_xmlrpc.dll
I tried this on my site hosted on linode but the plugin that caused it is still showing the error. Please what else can I do?
Hello.
Can you please post in our support forum, so our supporter can help you troubleshoot the issue?
Hello..Thanks for your reply….I solved this already. Below is the exact command that worked in my case. Maybe it will help any other person.
“apt install php7.2-xml”
Now if you can permit me to ask another question I will like to know if there is anyway to whitelist wordpress official mobile app from xmlprc ?
I disabled it but will want to enable it for only wordpress app… I found a closer solution but wasn’t able to figure out the IP address for the official wordpress app. See the closest solution I found below.
Order deny,allow
Request all denied
Allow from 197.210.53.176
Now, I have been unable to now how to include the wordpress mobile app by automattic to it.
You have any idea?
Thanks for the details! In order to be able to help you debug and resolve please open a new report in our support forum – https://wpml.org/forums/forum/english-support/ – it’s impossible for me to understand fully what’s going on without looking deeper at your site.
Alright sir. I’m on mobile now but will do that if I get to my PC.