Not a bug

Symptoms

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.

11 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

Leave a Reply

Please leave here comments about this page only.
For technical support and feature suggestions, head to our forum. We are waiting there!

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>