繁体   English   中英

centOS 7 无法安装 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

它将自动安装依赖项(php-common)

这个来自 AWS Amazon 论坛的回答:

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

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

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

您可以检查安装PHP版本php -v

$ 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

相反,你应该

使用 EasyApache 安装 mbstring PHP 扩展

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

php -m | grep 字符串

[如果没有,意味着缺少 mbstring]

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

单击管理器服务器,

打开 whm ----- 搜索 apache,

打开“easy apache 4”(我的情况)

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

经过

单击“当前安装的软件包...”旁边顶行的“自定义”按钮

搜索 mbstring,

单击它旁边的开/关切换。

单击下一步,下一步,.... 优先权.. 完成。

现在你应该有 mbstring

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

php -m | grep mbstring [应该看到mbstring]

或者你可以在 phpinfo() 页面找到 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

找了半天的答案,才发现 cPanel / WHM 版本的 CentOS 会禁用 YUM 更新 php。 您应该从/etc/yum.conf排除列表中删除php*

....

以上不适用于 Godaddy 专用服务器 centOS 6、apache 2.4、php 5.6

相反,您应该安装带有 EasyApache 检查的 mbstring PHP 扩展,如果您已经通过 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

谢谢,我的问题解决了

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM