Class 'DOMDocument' not found

后端 未结 16 1430
余生分开走
余生分开走 2020-11-30 18:58

I\'ve found an error on a page in my Magento application; it always show this message error when I visit it:

Fatal error: Class \'DOMDocument\' not fo

相关标签:
16条回答
  • 2020-11-30 19:56

    PHP 7.0:

    • Ubuntu: apt-get install php7.0-xml
    • CentOS / Fedora / Red Hat: yum install php70w-xml

    PHP 7.1:

    • Ubuntu: apt-get install php7.1-xml
    • CentOS / Fedora / Red Hat: yum install php71w-xml

    PHP 7.2:

    • Ubuntu: apt-get install php7.2-xml
    • CentOS / Fedora / Red Hat: yum install php72w-xml

    PHP 7.3:

    • Ubuntu: apt-get install php7.3-xml
    • CentOS / Fedora / Red Hat: yum install php73w-xml

    PHP 7.4:

    • Ubuntu: apt-get install php7.4-xml
    • CentOS / Fedora / Red Hat: yum install php74w-xml
    0 讨论(0)
  • 2020-11-30 19:58

    After a long time suffering from it in PHPunit...

    For those using namespace, which is very common with Frameworks or CMS, a good check in addition to seeing if php-xml is installed and active, is to remember to declare the DOMDocument after the namespace:

    namespace YourNameSpace\YourNameSpace;
    
    use DOMDocument; //<--- here, check this!
    
    0 讨论(0)
  • 2020-11-30 20:01

    This help for me (Ubuntu Linux) PHP 5.6.3

    sudo apt-get install php5.6-dom

    Thats work for me.

    0 讨论(0)
  • 2020-11-30 20:04

    If compiling from source with --disable-all then DOMDocument support can be enabled with
    --enable-dom

    Example:

    ./configure --disable-all --enable-dom
    

    Tested and working for Centos7 and PHP7

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