centOS 7 无法安装 php-mbstring 扩展
Posted
技术标签:
【中文标题】centOS 7 无法安装 php-mbstring 扩展【英文标题】:centOS 7 Can't install php-mbstring extension 【发布时间】:2015-04-28 16:17:37 【问题描述】:我已尝试安装扩展 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
我能做些什么来解决这个问题?
感谢您的帮助
【问题讨论】:
【参考方案1】:对于想知道如何解决这个问题的人:
sudo yum remove php-common
那么你可以:
sudo yum install php-mbstring
它会自动安装依赖项(php-common)
【讨论】:
在 linux php 版本 5.6.x 上运行sudo yum install php56-mbstring
@hyip 谢谢,我已经运行sudo yum install php56-mbstring
命令并重启服务器sudo service httpd restart
我的问题已经解决了。
这可能会导致完全卸载php及相关模块。
这样做破坏了我在 Amazon Linux AMI 版本 2016.09 上的 php 设置
这样做破坏了我在 Amazon EC2 上的 php 设置,但只有在此之后 - 才能安装所有其他模块(yum install php
、yum install php-pecl-mailparse.x86_64
)等【参考方案2】:
找了半天,才发现cPanel/WHM版本的CentOS会禁用YUM更新php。您应从/etc/yum.conf
的排除列表中删除php*
。
....
【讨论】:
【参考方案3】:来自 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
,也许,我不知道具体,但也许它只对亚马逊上的服务器有帮助。
【讨论】:
谢谢。最后一个命令,即yum-config-manager ....
在 AWS RHEL 7 上为我工作。
是的,我也是。谢谢!【参考方案4】:
所选答案可能会更改已安装的 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
【讨论】:
我得到了错误No package php55w-mbstring available.
@M-T-A:把cat /etc/redhat-release && php -v && yum search mbstring
的输出贴出来,我看看。【参考方案5】:
你必须指定和你的php-common相同的版本,我的是php70w-common
sudo yum install php70w-mbstring
【讨论】:
这正是我的问题。谢谢!【参考方案6】:以上不适用于 godaddy 专用服务器 centOS 6、apache 2.4、php 5.6
相反,你应该
使用 EasyApache 安装 mbstring PHP 扩展
检查你是否已经通过 putty 或 ssh 拥有它
php -m | grep mbstring
[如果没有,意味着缺少mbstring]
现在你需要转到godaddy你的帐户页面,
点击管理服务器,
打开whm -----搜索apache,
打开“easy apache 4”(我的案例)
现在你需要自定义当前安装的包,
通过
点击“当前安装的包...”旁边顶行的“自定义”按钮
搜索mbstring,
点击旁边的开/关切换。
点击下一步,下一步,.... privision..done.
现在你应该有 mbstring
通过 putty(ssh) 再次检查
php -m | grep mbstring [应该看到mbstring]
或者你可以在 phpinfo() 页面找到 mbstring
【讨论】:
【参考方案7】:以上不适用于 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)
现在你需要自定义当前安装的包,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.
现在你应该通过 putty(ssh) 再次检查来获得 mbstring
php -m | grep mbstring [should see mbstring]
或者你可以在 phpinfo() 页面找到 mbstring
谢谢,我的问题解决了
【讨论】:
【参考方案8】:需要搜索你需要的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 安装 php 的服务器,这是正确的答案【参考方案9】: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
【讨论】:
以上是关于centOS 7 无法安装 php-mbstring 扩展的主要内容,如果未能解决你的问题,请参考以下文章