如何在 CentOS 6.2 上安装 PHP mbstring


How to install PHP mbstring on CentOS 6.2

如何在 CentOS 6.2 上安装 PHP 的 mbstring

我试过:

$ sudo yum install php-mbstring
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirror.net.cen.ct.gov
 * extras: centos.aol.com
 * updates: mirrors.seas.harvard.edu
Setting up Install Process
No package php-mbstring available.
Error: Nothing to do

但是没有找到包裹?

执行以下操作:

sudo nano /etc/yum.repos.d/CentOS-Base.repo

updates 部分下,注释掉镜像列表行(在该行前面放一个#),然后在新行上写:

baseurl=http://centos.intergenia.de/$releasever/updates/$basearch/

现在尝试:

yum install php-mbstring

(之后你可能想要取消注释镜像列表并注释掉baseurl)

如果你有cPanel托管,你可以使用Easy Apache通过shell来做到这一点。这些是步骤。

  1. 键入 Easy Apache 路径键入 Easy Apache 的路径

    root@vps#### [~]#/scripts/easyapache

  2. 不要对"cPanel更新可用"说"是"。
  3. 继续浏览默认设置的屏幕,直到进入"详尽选项列表"。
  4. 向下翻页,直到您看到列出的 Mbstring 扩展名并选择它。
  5. 继续执行步骤并保存 Apache PHP 构建。

Apache和PHP现在将重建以包含mbstring扩展。等待该过程完成~10到30分钟。该过程完成后,您现在应该在phpinfo中看到Mbstring扩展名。

有关更详细的步骤,请参阅文章使用 Easy Apache

exclude= courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* php*

似乎您的服务器有一些脚本,例如cPanel

  1. 了解 php 版本 - php -v
  2. 搜索可用的 php 扩展 - yum search php-
  3. 安装 - yum install ea-php56-php-mbstring.x86_64
  4. 然后httpd -k restart

软件包名称 - ea-php-php-mbstring.x86_64

*确保先更新您的 Linux 盒子

yum update

如果有人仍然遇到此问题,这是一个有效的解决方案:

Centos-release : rpm -q centos-release

Centos 6.*

wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm

Centos 5.*

wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -ivh epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm

然后只需执行此操作即可更新

yum --enablerepo=remi upgrade php-mbstring

或者这个要安装

yum --enablerepo=remi install php-mbstring

yum install php-mbstring (根据 http://php.net/manual/en/mbstring.installation.php)

我认为您必须安装 EPEL 存储库 http://fedoraproject.org/wiki/EPEL

以上

都不适用于 godaddy 服务器 centOS 6、apache 2.4、php 5.6

相反,您应该

使用 EasyApache 安装 mbstring PHP 扩展

检查您是否已经拥有它,腻子或SSH

PHP -M | grep mbstring

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

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

单击管理器服务器,

打开 WHM -----搜索 Apache ,

打开"简易阿帕奇4"(我的情况)

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

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

搜索 MB字符串,

单击旁边的开/关切换。

单击下一步、下一步、....普里维亚..做。

现在你应该有 mbstring

再次检查腻子(SSH)

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

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

yum install php-mbstring 然后httpd -k restart没有为我做这件事,我认为应该编译这些选项,如下所述:

现在,配置和构建 PHP。这是你自定义PHP的地方 各种选项,例如将启用哪些扩展。跑 ./配置 --help 以获取可用选项的列表。在我们的示例中 我们将使用 Apache 2 和 MySQL 支持进行简单的配置。

如果您从源代码构建 Apache,如上所述,以下示例 将匹配您的 apxs 路径,但如果您安装了 Apache 其他一些 方式,您需要相应地调整 APXS 的路径。请注意, 某些发行版可能会将 APXS 重命名为 APXS2。

cd ../php-NN
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-mbstring
make
make install

如果您决定在安装后更改配置选项, 需要重新运行配置、生成和创建安装步骤。你 只需重启 Apache 即可让新模块生效。一个 不需要重新编译 Apache。

请注意,除非另有说明,否则"进行安装"也将安装 PEAR,各种PHP工具,如phpize,安装PHP CLI等等。

虽然这个页面说它是可选的:

-

-启用-MBSTRING 允许支持多字节字符串。这是可选的,因为如果不可用,将使用较慢的自定义代码。

我以前遇到过同样的问题。就我而言,我需要在GoDaddy VPS服务器上安装php-mbstring扩展。上述解决方案都对我不起作用。

我发现的是使用 GoDaddy 的 WHM(虚拟主机管理器)安装 PHP 扩展。任何使用 GoDaddy VPS 服务器的人都可以使用以下地址访问此页面。

http://{Your_Server_IP_Address}:2087

在此页面上,您可以轻松找到可以帮助您安装/升级php组件和扩展的Easy Apache软件。可以选择当前安装的配置文件并自定义,然后预配配置文件。Easy Apache的所有内容都是解释性的。

记得我为 HostGator 服务器做了非常相似的事情,但我不记得我实际上是如何为个人资料更新做的。

编辑:当您获得支持虚拟主机管理器的服务器时,您可以在WHM上添加/更新/删除php扩展。在 godaddy 服务器上,甚至建议在 WHM 上更新 PHP ini 设置。

sudo yum install php<version>w-mbstring

前任。 sudo yum install php56w-mbstring

如果以上方法都无法帮助您,并且您可以选择,请尝试获取其中一个 rpm 文件,例如:

WGET http://rpms.famillecollet.com/enterprise/6/remi/x86_64/php-mbstring-5.4.45-2.el6.remi.x86_64.rpm

然后使用 rpm,安装它忽略如下:

rpm -i --nodeps php-mbstring-5.4.45-2.el6.remi.x86_64.rpm

希望有帮助。