PHP7 : install ext-dom issue

前端 未结 5 1701
情歌与酒
情歌与酒 2020-11-27 10:48

I\'m running laravel 5.4 on Ubuntu 16.04 server with PHP7. trying to install cviebrock/eloquent-sluggable package throw some error:

pish@let:/ho         


        
相关标签:
5条回答
  • 2020-11-27 11:00

    For CentOS, RHEL, Fedora:

    $ yum search php-xml
    ============================================================================================================ N/S matched: php-xml ============================================================================================================
    php-xml.x86_64 : A module for PHP applications which use XML
    php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    php-xmlseclibs.noarch : PHP library for XML Security
    php54-php-xml.x86_64 : A module for PHP applications which use XML
    php54-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    php55-php-xml.x86_64 : A module for PHP applications which use XML
    php55-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    php56-php-xml.x86_64 : A module for PHP applications which use XML
    php56-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    php70-php-xml.x86_64 : A module for PHP applications which use XML
    php70-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    php71-php-xml.x86_64 : A module for PHP applications which use XML
    php71-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    php72-php-xml.x86_64 : A module for PHP applications which use XML
    php72-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    php73-php-xml.x86_64 : A module for PHP applications which use XML
    php73-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    

    Then select the php-xml version matching your php version:

    # php -v
    PHP 7.2.11 (cli) (built: Oct 10 2018 10:00:29) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    
    # sudo yum install -y php72-php-xml.x86_64
    
    0 讨论(0)
  • 2020-11-27 11:08

    For whom want to install ext-dom on php 7.1 and up run this command:

    sudo apt install php-xml
    
    0 讨论(0)
  • 2020-11-27 11:08

    sudo apt install php-xml will work but the thing is it will download the plugin for the latest PHP version.

    If your PHP version is not the latest, then you can add version in it:

    # PHP 7.1
    sudo apt install php7.1-xml
    
    # PHP 7.2:
    sudo apt install php7.2-xml
    
    # PHP 7.3
    sudo apt install php7.3-xml
    
    # PHP 7.4 (latest)
    sudo apt install php-xml
    
    0 讨论(0)
  • 2020-11-27 11:10

    First of all, read the warning! It says do not run composer as root! Secondly, you're probably using Xammp on your local which has the required php libraries as default.

    But in your server you're missing ext-dom. php-xml has all the related packages you need. So, you can simply install it by running:

    sudo apt-get update
    sudo apt install php-xml
    

    Most likely you are missing mbstring too. If you get the error, install this package as well with:

    sudo apt-get install php-mbstring
    

    Then run:

    composer update
    composer require cviebrock/eloquent-sluggable
    
    0 讨论(0)
  • 2020-11-27 11:16

    simply run

    sudo apt install php-xml
    

    its worked for me

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