laravel/framework 需要 ext-mbstring
Posted
技术标签:
【中文标题】laravel/framework 需要 ext-mbstring【英文标题】:laravel/framework requires ext-mbstring 【发布时间】:2018-08-11 18:39:24 【问题描述】:我正在使用 Kali linux,但我在安装 laravel 框架时遇到了困难。我在不同的链接中查找过,例如this 一个和许多其他链接,但似乎没有任何效果。对于我所做的每一件事。一直报这个错误
laravel/framework v5.5.9 requires ext-mbstring -> ...
...
例如:
root@iO-PC:/opt/lampp/htdocs/projects# composer create-project laravel/laravel Test "5.5.*"
处理中..这是显示的内容。
Installing laravel/laravel (v5.5.28)
- Installing laravel/laravel (v5.5.28): Loading from cache
Created project in Test
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework v5.5.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.8 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.7 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.6 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.5 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.4 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.36 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.35 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.34 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.33 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.32 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.31 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.30 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.3 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.29 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.28 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.27 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.26 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.25 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.24 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.23 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.22 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.21 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.20 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.19 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.18 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.17 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.16 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.15 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.14 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.13 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.12 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.11 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.10 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v5.5.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- Installation request for laravel/framework 5.5.* -> satisfiable by laravel/framework[v5.5.0, v5.5.1, v5.5.10, v5.5.11, v5.5.12, v5.5.13, v5.5.14, v5.5.15, v5.5.16, v5.5.17, v5.5.18, v5.5.19, v5.5.2, v5.5.20, v5.5.21, v5.5.22, v5.5.23, v5.5.24, v5.5.25, v5.5.26, v5.5.27, v5.5.28, v5.5.29, v5.5.3, v5.5.30, v5.5.31, v5.5.32, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.4, v5.5.5, v5.5.6, v5.5.7, v5.5.8, v5.5.9].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
- /etc/php/7.0/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.
我有什么办法解决这个问题?
【问题讨论】:
【参考方案1】:安装所需的mbstring扩展
sudo apt-get install php-mbstring
在 Dockerfile 中你应该添加:
RUN docker-php-ext-install mbstring
【讨论】:
这次是phpunit/phpunit 6.5.7 requires ext-dom -> ...
需要什么?剩下的句子?
用phpunit/phpunit 6.5.7 requires ext-dom
替换laravel/framework v5.5.1 requires ext-mbstring
但我使用了sudo apt-get install php7.0-xml
,现在它工作得很好。但是由于某种原因,即使在我使用sudo apt-get install php-mbstring
之前它也不起作用。但我认为是我安装了 laravel 5.5.*(需要 php >= 7.1.3)并且我安装了 7.0.1。
感谢您为我解决问题。【参考方案2】:
sudo apt install php-mbstring
将工作,并将下载最新 PHP 版本的插件。
如果您的 PHP 版本不是最新的,那么您可以在其中添加版本:
# PHP 7.1
sudo apt install php7.1-mbstring
# PHP 7.2:
sudo apt install php7.2-mbstring
# PHP 7.3
sudo apt install php7.3-mbstring
# PHP7.4
sudo apt install php-mbstring
【讨论】:
就我而言,我同时拥有 php8.0 和 php7.4,但我已将系统配置为使用 php8.0。当我运行sudo apt install php-mbstring
时,会为 php.0 安装 php-mbstring。为了得到它的php7.4,我做了sudo apt install php7.3-mbstring
,问题就解决了。
就我而言,对于 php8.1,php8.1-mbstring
作为最新的可能命名不起作用,但 php-mbstring
起作用。这与你在这里写的一致:最新的php版本只是php-
,只有以前的版本可以修复。【参考方案3】:
我在安装 Laravel 6 时遇到了同样的问题并收到这样的错误
Installing laravel/laravel (v6.12.0)
- Installing laravel/laravel (v6.12.0): Loading from cache
Created project in sistemLogin
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework v6.9.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.8.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.7.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.6.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.6.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.6.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.5.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.5.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.5.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.4.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.4.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.3.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.2.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.17.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.17.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.16.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.15.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.15.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.14.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.13.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.13.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.12.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.11.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.10.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v6.10.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework 6.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- Installation request for laravel/framework ^6.2 -> satisfiable by laravel/framework[6.x-dev, v6.10.0, v6.10.1, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.2.0, v6.3.0, v6.4.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0, v6.9.0].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.4/cli/php.ini
- /etc/php/7.4/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.4/cli/conf.d/10-opcache.ini
- /etc/php/7.4/cli/conf.d/10-pdo.ini
- /etc/php/7.4/cli/conf.d/20-calendar.ini
- /etc/php/7.4/cli/conf.d/20-ctype.ini
- /etc/php/7.4/cli/conf.d/20-curl.ini
- /etc/php/7.4/cli/conf.d/20-exif.ini
- /etc/php/7.4/cli/conf.d/20-ffi.ini
- /etc/php/7.4/cli/conf.d/20-fileinfo.ini
- /etc/php/7.4/cli/conf.d/20-ftp.ini
- /etc/php/7.4/cli/conf.d/20-gettext.ini
- /etc/php/7.4/cli/conf.d/20-iconv.ini
- /etc/php/7.4/cli/conf.d/20-json.ini
- /etc/php/7.4/cli/conf.d/20-mysqli.ini
- /etc/php/7.4/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.4/cli/conf.d/20-phar.ini
- /etc/php/7.4/cli/conf.d/20-posix.ini
- /etc/php/7.4/cli/conf.d/20-readline.ini
- /etc/php/7.4/cli/conf.d/20-shmop.ini
- /etc/php/7.4/cli/conf.d/20-sockets.ini
- /etc/php/7.4/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.4/cli/conf.d/20-sysvsem.ini
- /etc/php/7.4/cli/conf.d/20-sysvshm.ini
- /etc/php/7.4/cli/conf.d/20-tokenizer.ini
- /etc/php/7.4/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.
然后我尝试命令:
sudo apt-get install php-mbstring
之后我再次尝试安装laravel,仍然出现这样的问题
Installing laravel/laravel (v6.12.0)
- Installing laravel/laravel (v6.12.0): Loading from cache
Created project in sistemLogin
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/phpunit 8.5.x-dev requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.5.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.5.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.5.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
...........
所以如果这样的话,你可以试试命令
sudo apt-get update
sudo apt install php-xml
然后运行
composer update
composer require cviebrock/eloquent-sluggable
PHP7 : install ext-dom issue
【讨论】:
【参考方案4】:我用这个解决了我的问题:sudo apt-get install php-mbstring
【讨论】:
您的答案与已经接受的答案有何不同? 重复答案。以上是关于laravel/framework 需要 ext-mbstring的主要内容,如果未能解决你的问题,请参考以下文章
如何解决作曲家问题 - laravel/framework [..] 需要 ext-mcrypt * -> 您的系统中缺少请求的 PHP 扩展 mcrypt
需要ext-fileinfo。如何将其添加到我的composer.json文件中? http://pecl.php.net/get/Fileinfo-1.0.4.tgz
laravel4 composer报错 d11wtq/boris v1.0.10 requires ext-pcntl
Laravel,作曲家安装,不要安装 laravel/framework
如何在 Laravel Framework 7.29.3 中解析 laravel ui
在 vendor\laravel\framework\src\Illuminate\Container\Container.php 中未捕获的异常 'ReflectionException' 和消息