如何在CentOS 6.2上安装PHP mbstring

如何在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 

(之后你可能会想要取消注释reflection列表并注释掉基础)

如果你有cPanel托pipe,你可以使用Easy Apache来通过shell来完成。 这些是步骤。

  1. inputEasy Apache PathType作为Easy Apache的path

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

  2. 不要对“可用的cPanel更新”说“是”。
  3. 继续通过默认的屏幕,直到你到“详尽的选项列表”。
  4. 向下翻页,直到看到列出的Mbstring扩展名并将其选中。
  5. 继续执行步骤并保存Apache PHP构build。

Apache和PHP现在将重build为包含mbstring扩展。 等待过程完成〜10到30分钟。 一旦这个过程完成,你现在应该可以在phpinfo中看到Mbstring扩展。

有关更详细的步骤,请参阅使用Easy Apache安装mbstring扩展的文章

请检查你的/etc/yum.conf文件,也许是排除php包。

你应该从这行删除php* ,以便下载php-*包:

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

看来你的服务器有一些像cPanel一样的脚本

*确保你先更新你的Linux机器

 yum update 

如果有人仍然有这个问题,这是一个有效的解决scheme:

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安装php-mbstring(按照http://php.net/manual/en/mbstring.installation.php

我想你必须安装EPEL存储库http://fedoraproject.org/wiki/EPEL

作为yum install php-mbstring然后httpd -k restart没有为我做,我认为这些选项应该编译,如logging在这里 :

现在,configuration和build立PHP。 这是您使用各种选项自定义PHP的位置,例如将启用哪些扩展。 运行./configure –help以获取可用选项的列表。 在我们的例子中,我们将使用Apache 2和MySQL支持进行简单的configuration。

如果您是从源代码构buildApache的,如上所述,下面的示例将匹配apxs的path,但是如果您以其他方式安装了Apache,则需要相应地调整apxs的path。 请注意,有些发行版可能会将apxs重命名为apxs2。

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

如果您决定在安装后更改configuration选项,则需要重新运行configure,make和make install步骤。 您只需要重新启动Apache以使新模块生效。 Apache不需要重新编译。

请注意,除非另有说明,“make install”还将安装PEAR,phpize等各种PHP工具,安装PHP CLI等。

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

–enable-mbstring允许多字节string支持。 这是可选的,因为如果不可用,会使用较慢的自定义代码。

如果以上都没有帮助你,并且你有select的话,试试获取一个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

希望有所帮助。