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
- Create a website with WPML.
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.