Composer 安装 - 需要 ext-mbstring

Pak*_*ung 4 php apache cpanel mbstring composer-php

我正在尝试执行一个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
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

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

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

1:WHM - 已经设置为 7.1

在此处输入图片说明

2:cPanel - 已经设置为 7.1

在此处输入图片说明

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

在此处输入图片说明

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

rüf*_*ff0 7

尝试使用 aptitude 安装 mbstring php 库。

sudo apt-get install php-mbstring php7.1-mbstring
Run Code Online (Sandbox Code Playgroud)


Pak*_*ung 3

安装rh可以解决这个问题yum install rh-php56-php-mbstring.x86_64

请仔细检查您的服务器中的内容。我的rh-php56-php-mbstring.x86_64不是php-mbstring