Skip Navigation

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:

  1. Install or update to Ubuntu 15.10 (or earlier) or CentOS.
  2. Run the apt-get upgrade command.
  3. 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.

17 Responses to “PHP 7: possible issues with simplexml”

  1. 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 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

  2. 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.

  3. 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

  4. You also need to make sure you have the corresponding extension
    In your php.ini add/uncomment to following: extension=php_xmlrpc.dll

  5. 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?