Composer - 您的系统缺少请求的 PHP 扩展名 mbstring

Composer - the requested PHP extension mbstring is missing from your system

我最近尝试通过 Composer 安装软件包,但出现错误 the requested PHP extension mbstring is missing from your system. 我从 php.ini 中删除了分号,但它仍然不起作用。我该怎么办?

  1. 找到你的php.ini
  2. 确保设置了指令 extension_dir=C:\path\to\server\php\ext 并调整路径(设置你的 PHP 扩展目录)
  3. 确保指令 extension=php_mbstring.dll 已设置(未注释)

如果这不起作用并且缺少 php_mbstring.dll 文件,那么此堆栈的 PHP 安装就被破坏了。

我在 php.ini 中设置了 PHPRC 变量并取消注释 zend_extension=php_opcache.dll 并且一切正常。

sudo apt-get install php-mbstring

# if your are using php 7.1
sudo apt-get install php7.1-mbstring

# if your are using php 7.2
sudo apt-get install php7.2-mbstring

# if your are using php 7.4
sudo apt-get install php7.4-mbstring

为php7.1

sudo apt-get install php7.1-mbstring

干杯!