简体   繁体   English

centOS 7 无法安装 php-mbstring 扩展

[英]centOS 7 Can't install php-mbstring extension

i've tried to install the extension mbstring but i have the following error:我尝试安装扩展 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

What could i do to resolve the problem ?我能做些什么来解决这个问题?

Thanks for your help谢谢你的帮助

For people who want to know how to solve this :对于想知道如何解决这个问题的人:

sudo yum remove php-common

Then you can:然后你可以:

sudo yum install php-mbstring

It will automaticcaly install dependecies (php-common)它将自动安装依赖项(php-common)

This answer from AWS Amazon forum:这个来自 AWS Amazon 论坛的回答:

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

Then you can install php-mbstring , and maybe, I don't know exactly, but maybe it can help for servers on Amazon only.然后你可以安装php-mbstring ,也许,我不知道确切,但也许它只对亚马逊上的服务器有帮助。

The selected answer is liable to change the installed PHP version.所选答案可能会更改已安装的 PHP 版本。 When not using the stock CentOS PHP, yum will try to install the mbstring extension for the wrong version of PHP.当不使用 CentOS PHP 时, yum会尝试为错误版本的 PHP 安装mbstring扩展。

You can check your installed PHP version with php -v :您可以检查安装PHP版本php -v

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

Then go ahead and install the correct mbstring version for your installed PHP version:然后继续为安装的 PHP 版本安装正确的mbstring版本:

$ sudo yum install php55w-mbstring

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

 sudo yum install php70w-mbstring

Non of above works for godaddy dedicated server centOS 6, apache 2.4, php 5.6以上不适用于 Godaddy 专用服务器 centOS 6、apache 2.4、php 5.6

Instead, you should相反,你应该

Install the mbstring PHP Extension with EasyApache使用 EasyApache 安装 mbstring PHP 扩展

check if you already have it by, putty or ssh检查你是否已经拥有它,腻子或 ssh

php -m | php -m | grep mbstring grep 字符串

[if nothing, means missing mbstring] [如果没有,意味着缺少 mbstring]

Now you need to goto godaddy your account page,现在你需要转到godaddy你的账户页面,

click manager server,单击管理器服务器,

open whm ----- search for apache,打开 whm ----- 搜索 apache,

open "easy apache 4"(my case)打开“easy apache 4”(我的情况)

Now you need customize currently installed packages,现在您需要自定义当前安装的软件包,

by经过

click "customize" button on top line next to "currently installed package..."单击“当前安装的软件包...”旁边顶行的“自定义”按钮

search mbstring,搜索 mbstring,

click on/off toggle next to it.单击它旁边的开/关切换。

click next, next, .... privision..done.单击下一步,下一步,.... 优先权.. 完成。

Now you should have mbstring现在你应该有 mbstring

by check again at putty(ssh)通过在腻子(ssh)再次检查

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

or you can find mbstring at phpinfo() page或者你可以在 phpinfo() 页面找到 mbstring

need to search which mbstring version required you.需要搜索您需要哪个 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

now you can check what you actually need like i am using php7.1 so my command will be现在您可以像我使用 php7.1 一样检查您实际需要的内容,因此我的命令将是

sudo yum install ea-php71-php-mbstring

Been searching for the answer for half day, then only realise cPanel / WHM version of CentOS will disable YUM to update php.找了半天的答案,才发现 cPanel / WHM 版本的 CentOS 会禁用 YUM 更新 php。 You shall remove php* from exclude list in /etc/yum.conf .您应该从/etc/yum.conf排除列表中删除php*

.... ....

Non of above works for godaddy dedicated server centOS 6, apache 2.4, php 5.6以上不适用于 Godaddy 专用服务器 centOS 6、apache 2.4、php 5.6

Instead, you should install the mbstring PHP Extension with EasyApache check if you already have it by, putty or ssh相反,您应该安装带有 EasyApache 检查的 mbstring PHP 扩展,如果您已经通过 putty 或 ssh

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

Now you need to go to godaddy your account page,现在你需要去godaddy你的账户页面,

1.click manager server,

2.open whm ----- search for apache,

3.open "easy apache 4"(my case)

Now you need customize currently installed packages,by现在您需要自定义当前安装的软件包,通过

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.

Now you should have mbstring by check again at putty(ssh)现在你应该通过在 putty(ssh) 处再次检查来获得 mbstring

php -m | grep mbstring         [should see mbstring]

or you can find mbstring at phpinfo() page或者你可以在 phpinfo() 页面找到 mbstring

Thanks, my problem is done谢谢,我的问题解决了

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