PHP 7 simpleXML

前端 未结 9 1101
一整个雨季
一整个雨季 2020-12-14 05:19

I\'m testing PHP7, and have a weird issue after a recent update. SimpleXML should be enabled by default, and my phpinfo page shows that it is available:

相关标签:
9条回答
  • 2020-12-14 05:45

    For Alpine (in docker), you can use apk add php7-simplexml.

    If that doesn't work for you, you can run apk add --no-cache php7-simplexml. This is in case you aren't updating the package index first.

    0 讨论(0)
  • 2020-12-14 05:46

    For all those using Ubuntu with ppa:ondrej/php PPA this will fix the problem:

    apt install php7.0-mbstring php7.0-zip php7.0-xml

    (see https://launchpad.net/~ondrej/+archive/ubuntu/php)

    Thanks @Alexandre Barbosa for pointing this out!

    EDIT 20160423:

    One-liner to fix this issue:

    sudo add-apt-repository -y ppa:ondrej/php && sudo apt update && sudo apt install -y php7.0-mbstring php7.0-zip php7.0-xml
    

    (this will add the ppa noted above and will also make sure you always have the latest php. We use Ondřej's PHP ppa for almost two years now and it's working like charm)

    0 讨论(0)
  • 2020-12-14 05:48

    I had the same problem and I'm using Ubuntu 15.10.

    In my case, to solve this issue, I installed the package php7.0-xml using the Synaptic package manager, which include SimpleXml. So, after restart my Apache server, my problem was solved. This package came in the Debian version and you can find it here: https://packages.debian.org/sid/php7.0-xml.

    0 讨论(0)
  • 2020-12-14 05:53

    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.

    0 讨论(0)
  • 2020-12-14 05:59

    Had the same problem on AWS Linux 2, phpinfo() shows SimpleXML installed but not working, below cmd solved my issue

    sudo yum install php-xml
    
    0 讨论(0)
  • 2020-12-14 06:02

    For Ubuntu 14.04 with

    PHP 7.0.13-1+deb.sury.org~trusty+1 (cli) ( NTS )

    sudo apt-get install php-xml
    

    worked for me.

    0 讨论(0)
提交回复
热议问题