[英]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
”部分下,注释掉mirrorlist行(在该行的前面加一个#
),然后在新行中输入:
baseurl=http://centos.intergenia.de/$releasever/updates/$basearch/
现在尝试:
yum install php-mbstring
(之后,您可能需要取消注释镜像列表并注释掉baseurl)
如果您拥有cPanel托管,则可以使用Easy Apache通过Shell进行此操作。 这些是步骤。
root @ vps #### [〜]#/ scripts / easyapache
现在将重新构建Apache和PHP,以包括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
如果有人仍然有此问题,这是一个有效的解决方案:
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
php -v
yum search php-
yum install ea-php56-php-mbstring.x86_64
httpd -k restart
软件包名称-ea-php-php-mbstring.x86_64
百胜安装php-mbstring(根据http://php.net/manual/en/mbstring.installation.php )
我认为您必须安装EPEL储存库http://fedoraproject.org/wiki/EPEL
作为yum install php-mbstring
随后httpd -k restart
对我没有做到这一点,我觉得这些选项应该被编译,如记录在这里 :
现在,配置并构建PHP。 在这里,您可以使用各种选项来自定义PHP,例如将启用哪些扩展。 运行./configure --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
如果决定在安装后更改配置选项,则需要重新运行configure,make和make安装步骤。 您只需重新启动apache即可使新模块生效。 不需要重新编译Apache。
请注意,除非另有说明,否则“ make install”还将安装PEAR,各种PHP工具(如phpize),安装PHP CLI等。
尽管此页面说它是可选的:
--enable-mbstring允许多字节字符串支持。 这是可选的,因为如果不可用,将使用较慢的自定义代码。
我以前也遇到过同样的问题。 就我而言,我需要在GoDaddy VPS服务器上安装php-mbstring扩展。 以上解决方案均不适合我。
我发现的是使用GoDaddy的WHM(网络托管管理器)安装PHP扩展。 使用GoDaddy VPS服务器的任何人都可以使用以下地址访问此页面。
http:// {Your_Server_IP_Address}:2087
在此页面中,您可以轻松找到Easy Apache软件,该软件可以帮助您安装/升级php组件和扩展。 您可以选择当前安装的配置文件并进行自定义,然后置备该配置文件。 Easy Apache的所有功能都是说明性的。
我记得我对HostGator服务器做了非常相似的事情,但是我不记得我实际上是如何进行配置文件更新的。
编辑:当您拥有支持Web Hosting Manager的服务器时,则可以在WHM上添加/更新/删除php扩展。 在Godaddy服务器上,甚至建议您更新WHM上的PHP ini设置。
以上都不适用于Godaddy服务器centOS 6,Apache 2.4,PHP 5.6
相反,您应该
使用EasyApache安装mbstring PHP扩展
检查是否已经使用腻子或ssh
php -m | grep mbstring
[如果没有,则意味着缺少mbstring]
现在您需要转到Godaddy您的帐户页面,
点击管理器服务器,
打开Whm -----搜索apache,
打开“简易Apache 4”(我的情况)
现在,您需要自定义当前安装的软件包,
通过
单击“当前安装的软件包...”旁边第一行的“自定义”按钮。
搜索mbstring,
单击它旁边的开/关切换。
单击下一步,下一步,.. privision ..完成。
现在你应该有mbstring
通过再次检查腻子(ssh)
php -m | grep mbstring [应该看到mbstring]
或者您可以在phpinfo()页面上找到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
希望有帮助。
sudo yum install php<version>w-mbstring
例如 须藤百胜安装php56w-mbstring
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.