【问题标题】:LAMP PHP configurationLAMP PHP 配置
【发布时间】:2018-05-09 16:01:42
【问题描述】:

操作系统:Ubuntu 17.10 (Artful Aardvark)

我已经安装了 LAMP 堆栈和 Laravel,当我在 Laravel 应用程序中尝试 composer install 时,出现以下错误。

- Installation request for phar-io/manifest 1.0.1 -> satisfiable by phar-io/manifest[1.0.1].
  - phar-io/manifest 1.0.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 2
  - Installation request for phpunit/php-code-coverage 5.2.2 -> satisfiable by phpunit/php-code-coverage[5.2.2].
  - phpunit/php-code-coverage 5.2.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 3
  - Installation request for phpunit/phpunit 6.4.3 -> satisfiable by phpunit/phpunit[6.4.3].
  - phpunit/phpunit 6.4.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
Problem 4
  - Installation request for theseer/tokenizer 1.1.0 -> satisfiable by theseer/tokenizer[1.1.0].
  - theseer/tokenizer 1.1.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.

To enable extensions, verify that they are enabled in your .ini files:
  - /etc/php/7.1/cli/php.ini
  - /etc/php/7.1/cli/conf.d/10-opcache.ini
  - /etc/php/7.1/cli/conf.d/10-pdo.ini
  - /etc/php/7.1/cli/conf.d/20-calendar.ini
  - /etc/php/7.1/cli/conf.d/20-ctype.ini
  - /etc/php/7.1/cli/conf.d/20-exif.ini
  - /etc/php/7.1/cli/conf.d/20-fileinfo.ini
  - /etc/php/7.1/cli/conf.d/20-ftp.ini
  - /etc/php/7.1/cli/conf.d/20-gettext.ini
  - /etc/php/7.1/cli/conf.d/20-iconv.ini
  - /etc/php/7.1/cli/conf.d/20-json.ini
  - /etc/php/7.1/cli/conf.d/20-mbstring.ini
  - /etc/php/7.1/cli/conf.d/20-pdo.ini
  - /etc/php/7.1/cli/conf.d/20-phar.ini
  - /etc/php/7.1/cli/conf.d/20-posix.ini
  - /etc/php/7.1/cli/conf.d/20-readline.ini
  - /etc/php/7.1/cli/conf.d/20-shmop.ini
  - /etc/php/7.1/cli/conf.d/20-sockets.ini
  - /etc/php/7.1/cli/conf.d/20-sysvmsg.ini
  - /etc/php/7.1/cli/conf.d/20-sysvsem.ini
  - /etc/php/7.1/cli/conf.d/20-sysvshm.ini
  - /etc/php/7.1/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

我重新检查了文件,所有扩展都已启用,它们位于 /usr/lib/php/20160303 文件夹。

【问题讨论】:

    标签: php laravel ubuntu lamp lampp


    【解决方案1】:

    正如日志所说,我们需要安装扩展“dom”。我们就是这样做的:

    sudo apt install php7.1-dom
    

    如果日志显示仅缺少一个扩展名,则上述命令有效。如果缺少其他扩展,您可以在同一行中添加这些扩展,如下所示:

    sudo apt install php7.1-dom php7.1-ext-mbstring
    

    就是这样。现在您在安装 PHP Composer 时不会遇到任何问题。输入composer install

    【讨论】:

      【解决方案2】:

      如果仍然遇到问题,请尝试

      sudo apt-get install -y php7.1 php7.1-xml php7.1-mysql php7.1-curl php7.1-mbstring
      

      【讨论】:

      • 为我工作!谢谢你。我已经尝试安装 php-xml 并且遇到了同样的问题。
      • 太棒了!非常感谢。
      【解决方案3】:

      尝试以下命令:

      sudo apt-get install php-mbstring
      sudo apt-get install php-xml
      

      【讨论】:

        【解决方案4】:

        有时问题在于 php-xml 扩展。

        试试:

        sudo apt-get install php-xml
        

        【讨论】:

        • 这很奇怪,错误与 xml 无关,但这确实有效!谢谢。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-08-18
        • 1970-01-01
        • 1970-01-01
        • 2011-10-06
        • 2022-01-17
        • 2023-03-07
        相关资源
        最近更新 更多