我正在尝试执行 composer install ... ,但出现 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system. 错误我正在使用 Apache (Cpanel) 和 PHP 5.6。

以下是我尝试修复错误的方法。

1:yum search mbstring

============================================= N/S matched: mbstring =============================================
ea-php54-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php55-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php56-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php70-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php71-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php72-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
rh-php56-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
rh-php70-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
rh-php71-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling

2:yum install ea-php56-php-mbstring.x86_64
Loaded plugins: fastestmirror, universal-hooks
Loading mirror speeds from cached hostfile
 * EA4: 110.4.45.120
 * cpanel-addons-production-feed: 110.4.45.120
 * base: ftp.cuhk.edu.hk
 * centosplus: ftp.cuhk.edu.hk
 * epel: ftp.cuhk.edu.hk
 * extras: ftp.cuhk.edu.hk
 * ius: hkg.mirror.rackspace.com
 * updates: ftp.cuhk.edu.hk
Package ea-php56-php-mbstring-5.6.35-1.1.5.cpanel.x86_64 already installed and latest version
Nothing to do

似乎 mbstring 已安装,但为什么在尝试 Composer 安装时出现错误?

另一种方式(在cPanel中更新PHP版本)

1:WHM - 已经设置为 7.1

php - Composer 安装 - 需要 ext-mbstring-LMLPHP

2:cPanel - 已经设置为 7.1

php - Composer 安装 - 需要 ext-mbstring-LMLPHP

但是服务器中的版本仍然是 5.6

php - Composer 安装 - 需要 ext-mbstring-LMLPHP

有什么建议可以解决 require ext-mbstring 错误?

最佳答案

尝试使用 aptitude 安装 mbstring php 库。

sudo apt-get install php-mbstring php7.1-mbstring

关于php - Composer 安装 - 需要 ext-mbstring,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49977589/

10-11 08:01