【问题标题】:Unable to install Laravel on Ubuntu 18.10 LEMP stack?无法在 Ubuntu 18.10 LEMP 堆栈上安装 Laravel?
【发布时间】:2019-08-16 02:13:33
【问题描述】:

运行laravel new 时,我收到所有这些错误。我理解他们的意思,但我很好奇为什么会发生这种情况,在 Windows 上一切正常。

我安装了php,Ubuntu怎么会报错?它是否从 php 安装中排除了很多东西?我不太确定为什么它会引起如此大的戏剧性,这是我今天经历的第 10 组错误,我担心我做错了什么。

我的 LEMP 堆栈遵循了这个:https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-ubuntu-18-04

另外,在我什至可以使用laravel 命令之前,我每次打开终端时都必须运行export PATH="~/.composer/vendor/bin:$PATH"。有没有办法解决这个问题?

  Problem 1
    - Installation request for erusev/parsedown v1.7.2 -> satisfiable by erusev/parsedown[v1.7.2].
    - erusev/parsedown v1.7.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  Problem 2
    - Installation request for laravel/framework v5.8.7 -> satisfiable by laravel/framework[v5.8.7].
    - laravel/framework v5.8.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  Problem 3
    - Installation request for phar-io/manifest 1.0.3 -> satisfiable by phar-io/manifest[1.0.3].
    - phar-io/manifest 1.0.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 4
    - Installation request for phpunit/php-code-coverage 6.1.4 -> satisfiable by phpunit/php-code-coverage[6.1.4].
    - phpunit/php-code-coverage 6.1.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 5
    - Installation request for phpunit/phpunit 7.5.7 -> satisfiable by phpunit/phpunit[7.5.7].
    - phpunit/phpunit 7.5.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 6
    - 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.
  Problem 7
    - laravel/framework v5.8.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - beyondcode/laravel-dump-server 1.2.2 requires illuminate/console 5.6.*|5.7.*|5.8.* -> satisfiable by laravel/framework[v5.8.7].
    - Installation request for beyondcode/laravel-dump-server 1.2.2 -> satisfiable by beyondcode/laravel-dump-server[1.2.2].

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

【问题讨论】:

    标签: php laravel ubuntu composer-php


    【解决方案1】:

    您使用的是哪个 PHP 版本?

    您需要安装 mbstring 扩展。

    假设它是 PHP7.2,你可以安装 Laravel 所需的依赖,如:

    sudo apt install php7.2-mbstring php7.2-dom php7.2-pdo php7.2-xml php7.2-common php7.2-bcmath php7.2-json php7.2-cli php7.2-fpm php7.2-mysql
    

    编辑:该 LEMP 指南不包括 php 扩展的安装。

    假设它是 Laravel 5.8,根据docs,你还需要安装一些扩展。相应地更新我的答案

    注意:如果您需要 MySQL 等(因为您提到了 LEMP),我还添加了 php7.2-mysql。

    虽然,就像我在 cmets 中提到的那样,我更喜欢 Ondrej Sury 的 PPA 并安装 PHP7.3 及其扩展。

    【讨论】:

    • 我明白这一点。我正在使用 PHP 7.2 并已安装它,如果您检查我的问题,我会问为什么它会抛出这么多错误并且我做了一些严重错误的事情,在 Windows 中它可以解决问题。不过感谢您的回答。
    • @AdamG,阿尔达是对的。当你开始从上到下修复问题时,你会看到当你修复一个东西时,它又修复了几行。可能你也需要为ext-dom 这样做
    • @AdamG 我强烈建议 Ondrej Sury 的 PPA 用于 PHP 安装。我在 Debian 和 Ubuntu 上安装了他的版本将近 6 年,没有任何问题:launchpad.net/%7Eondrej/+archive/ubuntu/php。我不必处理任何路径或其他东西,它们总是最新的。我几乎可以肯定你的 php7.2-cli 的 ini 文件映射了其他地方的扩展文件,说它已经安装了扩展包,因为该指南不包括 PHP 扩展的安装。
    • @AdamG 更新了我的答案,如果我没记错的话,现在它应该安装所有必需的扩展。
    • 当我尝试安装任何版本的 Laravel (5.8.6.x, 7.x)。我安装了 php7.3-zip, unzip for linux 并返回几个错误: unzip -qq failed in most packages 有人知道如何解决吗?谢谢
    猜你喜欢
    • 2016-02-29
    • 1970-01-01
    • 2022-11-04
    • 1970-01-01
    • 2017-07-17
    • 2020-09-28
    • 2017-11-17
    • 2021-10-23
    • 1970-01-01
    相关资源
    最近更新 更多