gpt4 book ai didi

php - 无法在 Ubuntu 18.10 LEMP 堆栈上安装 Laravel?

转载 作者:行者123 更新时间:2023-12-04 18:44:39 26 4
gpt4 key购买 nike

运行时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 版本?

您需要安装 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。

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

关于php - 无法在 Ubuntu 18.10 LEMP 堆栈上安装 Laravel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55344550/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com