centOS 7 Can';t安装php-mbstring扩展


centOS 7 Can't install php-mbstring extension

我尝试安装扩展mbstring,但出现以下错误:

    Error: Package: php-mbstring-5.4.16-23.el7_0.3.x86_64 (updates)
        Requires: php-common(x86-64) = 5.4.16-23.el7_0.3
        Installed: php-common-5.4.38-1.el7.remi.x86_64 (@remi)
        php-common(x86-64) = 5.4.38-1.el7.remi
        Available: php-common-5.4.16-21.el7.x86_64 (base)
        php-common(x86-64) = 5.4.16-21.el7
        Available: php-common-5.4.16-23.el7_0.x86_64 (updates)
        php-common(x86-64) = 5.4.16-23.el7_0
        Available: php-common-5.4.16-23.el7_0.1.x86_64 (updates)
        php-common(x86-64) = 5.4.16-23.el7_0.1
        Available: php-common-5.4.16-23.el7_0.3.x86_64 (updates)
        php-common(x86-64) = 5.4.16-23.el7_0.3
    You could try using --skip-broken to work around the problem
    You could try running: rpm -Va --nofiles --nodigest

我能做些什么来解决这个问题?

感谢您的帮助

对于想知道如何解决此问题的人:

sudo yum remove php-common

然后你可以:

sudo yum install php-mbstring

它将自动安装dependencies(php-common)

来自AWS亚马逊论坛的答案:

yum -y install yum-utils
yum repolist all
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

然后你可以安装php-mbstring,也许,我不知道确切的,但也许它只对亚马逊上的服务器有帮助。

需要搜索需要哪个mbstring版本。

cat /etc/redhat-release && php -v && 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
ea-php73-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling

现在你可以像我使用php7.1一样检查你实际需要的东西,所以我的命令将是

sudo yum install ea-php71-php-mbstring

所选答案可能会更改已安装的PHP版本当不使用现有的CentOS PHP时,yum会尝试为错误版本的PHP安装mbstring扩展。

您可以使用php -v:检查您安装的PHP版本

$ php -v
PHP 5.5.36 (cli) (built: May 28 2016 12:05:32)

然后继续为安装的PHP版本安装正确的mbstring版本:

$ sudo yum install php55w-mbstring

您必须指定与您的php common相同的版本,我的是php70w common

 sudo yum install php70w-mbstring

以上的非适用于godaddy专用服务器centOS 6、apache 2.4、php 5.6

相反,你应该

使用EasyPache 安装mbstring PHP扩展

检查你是否已经有了,腻子或ssh

php-m|grep-mbstring

[如果没有,则表示缺少mbstring]

现在你需要转到godaddy你的帐户页面,

点击管理服务器

打开whm-----搜索apache、

打开"easyApache4"(我的案例)

现在您需要自定义当前安装的软件包,

通过

点击"当前安装的软件包…"旁边顶行的"自定义"按钮

搜索字符串

点击旁边的开关。

单击next,next。。。。特权。。完成。

现在你应该有mbstring

通过在腻子(ssh)上再次检查

php-m | grep mbstring[应查看mbstring]

或者您可以在phpinfo()页面

中找到mbstring

以上非适用于godaddy专用服务器centOS 6,apache 2.4,php 5.6

相反,您应该使用EasyPache安装mbstring PHP扩展,检查您是否已经拥有by、putty或ssh

php -m | grep mbstring       [if nothing, means missing mbstring]

现在你需要去godaddy你的账户页面,

1.click manager server,
2.open whm ----- search for apache,
3.open "easy apache 4"(my case)

现在您需要通过自定义当前安装的软件包

4.click "customize" button on top line next to "currently installed package..."
5.In the search bar write "mbstring",
6.click on/off toggle next to it.
7.click next, next, .... privision..done.

现在,您应该通过在putty(ssh)上再次检查来获得mbstring

php -m | grep mbstring         [should see mbstring]

或者你可以在phpinfo()页面上找到mbstring

谢谢,我的问题已经解决了

已经搜索了半天的答案,然后才意识到cPanel/WHM版本的CentOS会禁用YUM来更新php。您应将php*/etc/yum.conf的排除列表中删除。

Fedora 28(云版)

sudo yum install php56-php-mbstring
sudo yum install php70-php-mbstring
sudo yum install php71-php-mbstring
sudo yum install php72-php-mbstring
sudo yum install php73-php-mbstring