Linux 努力在 Centos 上安装 PHP pecl
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19517095/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
struggling to install PHP pecl on Centos
提问by Harry
I'm trying to install the php_http
PHP extension on my CentOS server.
我正在尝试php_http
在我的 CentOS 服务器上安装PHP 扩展。
I have done:
我已经做好了:
yum install php-pear
But get:
但是得到:
No package php-pear available
Yet I can do:
但我可以这样做:
pear
And get a list of commands from Pear.
并从 Pear 获取命令列表。
Same for yum install pecl
. I can do pecl
but pecl install pecl_http
returns:
对于yum install pecl
. 我可以做pecl
但pecl install pecl_http
返回:
No releases available for package "pecl.php.net/pecl_http"
install failed
Yet /usr/bin/pecl
isn't a directory that exists. Also a sudo pecl install pecl_http
returns sudo: pecl: command not found
, which I find quite odd.
然而/usr/bin/pecl
不是一个存在的目录。还有一个sudo pecl install pecl_http
Returns sudo: pecl: command not found
,我觉得这很奇怪。
I'm not entirely sure what's going on here/what I'm doing wrong.
我不完全确定这里发生了什么/我做错了什么。
edit: I am using the following repos:
编辑:我正在使用以下存储库:
base CentOS-6 - Base
epel Extra Packages for Enterprise Linux 6 - x86_64
extras CentOS-6 - Extras
rpmforge RHEL 6 - RPMforge.net - dag
updates CentOS-6 - Updates
vz-base vz-base
vz-updates vz-updates
回答by Latheesan
Step 1) import the REMI repo
步骤 1) 导入 REMI 存储库
CentOS 5
CentOS 5
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm;
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm;
CentOS 6
CentOS 6
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm;
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm;
Step 2) install php-pear
步骤 2) 安装 php-pear
yum --enablerepo=remi,remi-php55 install php-pear
Step 3) install pecl_http
步骤 3) 安装 pecl_http
pecl install pecl_http
回答by laapsaap
If you are using php 5.4.x, IMO best repo to use is iuscommunity. Its very stable and used by Rackspace to do only PHP and a few other packages for CentOS.
如果您使用的是 php 5.4.x,IMO 最好使用的存储库是 iuscommunity。它非常稳定,并被 Rackspace 用于为 CentOS 仅执行 PHP 和其他一些软件包。
rpm -Uhv http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm
rpm -Uhv http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm
yum install php54-pear
yum 安装 php54-pear
Mind you, the reason why its php54-pear and not php-pear is because 5.3 and 5.4 both are compiled in the repository. Here is the list of php packages -> http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/repoview/development.languages.group.html
请注意,它的 php54-pear 而不是 php-pear 的原因是因为 5.3 和 5.4 都在存储库中编译。这是 php 包列表 -> http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/repoview/development.languages.group.html
I tested this and it works, but I only use EPEL and iuscommunity REPO's. I avoid using rpmforge myself.
我对此进行了测试并且它有效,但我只使用 EPEL 和 iuscommunity REPO。我自己避免使用 rpmforge。
回答by pnomolos
For other people having this problem. I discovered this question while trying to figure out why I was having the same problem. Turned out the default configuration at my hosting provider was to include php*
in the exclude
directive for yum. Check /etc/yum.conf
and make sure that the package you're trying to install isn't matched by an entry in the exclude
directive.
对于遇到此问题的其他人。我在试图弄清楚为什么我遇到同样的问题时发现了这个问题。原来我的托管服务提供商的默认配置是包含php*
在exclude
yum 指令中。检查/etc/yum.conf
并确保您尝试安装的软件包与exclude
指令中的条目不匹配。
回答by Chuong Van Nguyen
On CentOS,
在 CentOS 上,
Install PHP Pear if not installed yet:
# yum install php-pear
Install GCC if not installed yet:
# yum install gcc
Install cURL if not installed yet:
# yum install curl-devel
Install following libraries if not installed yet:
# yum install php-devel # yum install zlib-devel # yum install pcre-devel
Start the main installation:
# pecl install pecl_http
Add the following line to /etc/php.ini file
extension=raphf.so extension=propro.so extension=http.so
Restart apache server so the extension can be loaded
# service httpd restart
如果尚未安装,请安装 PHP Pear:
# yum install php-pear
如果尚未安装,请安装 GCC:
# yum install gcc
如果尚未安装,请安装 cURL:
# yum install curl-devel
如果尚未安装,请安装以下库:
# yum install php-devel # yum install zlib-devel # yum install pcre-devel
开始主安装:
# pecl install pecl_http
将以下行添加到 /etc/php.ini 文件
extension=raphf.so extension=propro.so extension=http.so
重新启动 apache 服务器以便可以加载扩展
# service httpd restart
You can check if it installed successfully or not:
您可以检查它是否安装成功:
# pecl list
回答by jeremyforan
if you are running php 7 you might want to try this
如果你正在运行 php 7 你可能想试试这个
yum install php70w-pear
if you get any errors, be sure to uninstall the pear package from any previous attempts
如果您遇到任何错误,请务必从之前的任何尝试中卸载梨包
yum remove php-pear
best of luck
祝你好运
回答by PayToPwn
After watching a lot of threads and installing pear and all the devtool, I finally solved it installing this extension:
在看了很多线程并安装了 pear 和所有 devtool 之后,我终于解决了它安装这个扩展:
yum install php-pecl-mongo
as I seen in - https://madcoda.com/2012/12/install-mongodb-php-driver-in-centos-6-3/
正如我所看到的 - https://madcoda.com/2012/12/install-mongodb-php-driver-in-centos-6-3/
回答by josef
Centos 6.5 and php7:
Centos 6.5 和 php7:
sudo su -
yum install yum-utils
you can get last version of lua : http://pecl.php.net/package/lua
你可以获得lua的最新版本:http: //pecl.php.net/package/lua
wget http://pecl.php.net/get/lua-2.0.4.tgz
tar -xvzf lua-2.0.4.tgz
cd lua-2.0.4
mkdir /usr/include/lua
mv * /usr/include/lua
yum install gcc
yum install php70w-pearl php70w-devel
yum install curl-devel
yum install zlib-devel
yum install pcre-devel
ln -s /usr/include/lua.h /usr/include/lua/lua.h
rpm -Uvh https://centos6.iuscommunity.org/ius-release.rpm
yum-config-manager --enable remi-php70
yum update
yum --enablerepo=remi,remi-php70 install php70w-pear
yum install lua-devel lua-static
pecl install lua-2.0.4
回答by Remi Collet
Whatever your PHP provider is (IUS, Remi or Webtatic), the pear package and the pecl extensions "should" be available there, without any need to compile it from sources (which is usually discouraged, especially on production)
无论您的 PHP 提供程序是什么(IUS、Remi 或 Webtatic),pear 包和 pecl 扩展“应该”在那里可用,无需从源代码编译它(通常不鼓励,尤其是在生产中)
At least "remi" provides most extensions, see the list
至少“remi”提供了大多数扩展,见列表
So installation should be as simple as
所以安装应该很简单
yum install php-pecl-http
yum install php-pecl-lua
etc
And, don't forget to read the Wizard instructions
并且,不要忘记阅读向导说明