安装 Laravel 时作曲家错误:缺少“mbstring”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31690561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 17:04:48  来源:igfitidea点击:

Composer error while installing Laravel: 'mbstring' is missing?

laravelframeworkscomposer-php

提问by Barry D.

I've decided to try out Laravel and I've been going on and off with the installation because of how tedious it is in comparison to OOP PHP.

我决定尝试 Laravel 并且我一直在不断地安装,因为与 OOP PHP 相比它是多么乏味。

Nontheless I'm trying to execute the 'composer create-project laravel/laravel --prefer-dist' command on my cmd(.~/wamp/www/) and it created the Laravel folder but gives me this output:

尽管如此,我正在尝试在我的 cmd(.~/wamp/www/) 上执行“composer create-project laravel/laravel --prefer-dist”命令,它创建了 Laravel 文件夹,但给了我这个输出:

*Installing laravel/laravel (v5.1.4)
  - Installing laravel/laravel (v5.1.4)
    Loading from cache

Created project in C:\wamp\www\laravel
> php -r "copy('.env.example', '.env');"
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework v5.1.8 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - laravel/framework v5.1.7 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - laravel/framework v5.1.6 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - laravel/framework v5.1.5 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - laravel/framework v5.1.4 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - laravel/framework v5.1.3 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - laravel/framework v5.1.2 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - laravel/framework v5.1.1 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - laravel/framework v5.1.0 requires ext-mbstring * -> the requested PHP exte
nsion mbstring is missing from your system.
    - Installation request for laravel/framework 5.1.* -> satisfiable by laravel
/framework[v5.1.0, v5.1.1, v5.1.2, v5.1.3, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.
8].
C:\wamp\www>*

I am using windows.

我正在使用窗户。

I have tried installing a fresh composer, I have tried copying a laravel directory and placing it in my /www manually.

我试过安装一个新的作曲家,我试过复制一个 Laravel 目录并手动将它放在我的 /www 中。

I've made sure that WAMP is using all modules and extensions according to what I read.

我已经确保 WAMP 根据我阅读的内容使用所有模块和扩展。

I've edited the php.ini file and taken of the semi-colons where necessary.

我已经编辑了 php.ini 文件并在必要时去掉了分号。

And now after a bit of Google Searching, I am lost.

现在经过一些谷歌搜索,我迷路了。

Could anybody help me with this problem please, I would appreciate it.

任何人都可以帮助我解决这个问题,我将不胜感激。

Thanks in advance!

提前致谢!

Below is my PHP.ini file

下面是我的 PHP.ini 文件

So I couldn't paste the whole thing, but take a look at it here:

所以我无法粘贴整个内容,但请看这里:

http://jpst.it/AAhW

http://jpst.it/AAhW

回答by Eltyer

I had the same problem. Here's the solution.

我有同样的问题。这是解决方案。

  1. Go to your php.ini file.
  2. Locate the extension "extension=php_mbstring.dll". (ctrl+f might not work, just locate the long list with extensions in php.ini)
  3. Uncomment the extension, you do this by removing the semicolon in the same line.
  4. Save your php.ini file.
  1. 转到您的 php.ini 文件。
  2. 找到扩展名“extension=php_mbstring.dll”。(ctrl+f 可能不起作用,只需在 php.ini 中找到带有扩展名的长列表)
  3. 取消对扩展名的注释,您可以通过删除同一行中的分号来完成此操作。
  4. 保存您的 php.ini 文件。

This probably won't be the last time you'll encounter something like this. As a rule of thumb, read the error carefully and make the appropriate change to your php.ini file.

这可能不会是你最后一次遇到这样的事情。根据经验,请仔细阅读错误并对 php.ini 文件进行适当的更改。

Good luck!

祝你好运!

回答by Stranger

Installing php-mbstringusing,

安装php-mbstring使用,

sudo apt-get install php-mbstring

should fix this.

应该解决这个问题。

回答by Muhammad Asif Javed

There are couple of errors when i was trying to install on my linux machine :

当我尝试在我的 linux 机器上安装时有几个错误:

  1. laravel/framework v5.4.9 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
  2. phpunit/phpunit 5.7.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  1. laravel/framework v5.4.9 需要 ext-mbstring * -> 系统中缺少请求的 PHP 扩展 mbstring。
  2. phpunit/phpunit 5.7.9 需要 ext-dom * -> 您的系统中缺少请求的 PHP 扩展 dom。

sudo apt-get install php-mbstring

sudo apt-get install php-dom

须藤 apt-get 安装 php-mbstring

须藤 apt-get 安装 php-dom

So in short all the error such such as

所以简而言之,所有的错误,如

  • jenssegers/mongodb v3.2.0 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2].
    • jenssegers/mongodb v3.2.1 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2].
    • jenssegers/mongodb v3.2.2 requires mongodb/mongodb ^1.0.0 -> satisfiable by mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2].
    • mongodb/mongodb 1.1.2 requires ext-mongodb ^1.2.0 -> the requested PHP extension mongodb is missing from your system.
  • jenssegers/mongodb v3.2.0 需要 mongodb/mongodb ^1.0.0 -> 满足 mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1、1.1.2]。
    • jenssegers/mongodb v3.2.1 需要 mongodb/mongodb ^1.0.0 -> 可满足 mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1、1.1.2]。
    • jenssegers/mongodb v3.2.2 需要 mongodb/mongodb ^1.0.0 -> 满足 mongodb/mongodb[1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1、1.1.2]。
    • mongodb/mongodb 1.1.2 需要 ext-mongodb ^1.2.0 -> 系统中缺少请求的 PHP 扩展 mongodb。

you can simply run the following commands:

您可以简单地运行以下命令:

sudo apt-get install php-*

sudo apt-get install php-*

Thanks

谢谢