pecl安装mongodb

来源:互联网 发布:恶灵附身2优化这么样 编辑:程序博客网 时间:2024/06/05 19:45

今天着实又运维了一把,有台测试环境的机器php不完整,结果在使用pecl install mongodb的时候爆出了一大堆问题,花了将近一天时间才解决。过程中遇到的问题现象和解决方法整理如下:

1、pecl install mongodb
提示:
Warning: Invalid argument supplied for foreach() in Command.php on line 259
Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 259
...etc etc etc...等一大堆错误
解决方案:vi `which pecl`去掉-n
参考:http://serverfault.com/questions/589877/pecl-command-produces-long-list-of-errors

之后提示:
running: phpize
Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
ERROR: `phpize' failed
解决方案:安装php-devel
参考:http://wangzq-phper.iteye.com/blog/2297792
2、yum install php-devel
提示:
Error: Package: pcre-devel-8.32-12.el7.x86_64 (core-0)
           Requires: pcre(x86-64) = 8.32-12.el7
           Installed: pcre-8.32-15.el7_2.1.x86_64 (@updates)
               pcre(x86-64) = 8.32-15.el7_2.1
           Available: pcre-8.32-12.el7.x86_64 (core-0)
               pcre(x86-64) = 8.32-12.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
解决方案:pcre降级
3、yum downgrade pcre
4、yum install php-devel
5、pecl install mongodb
提示:
configure: error: in `/tmp/pear/install/pear-build-rootUhyP0B/mongodb-1.2.2':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
ERROR: `/tmp/pear/install/mongodb/configure --with-php-config=/usr/bin/php-config' failed
解决方案:yum install gcc
6、yum install gcc
提示:
Error: Package: glibc-2.17-55.el7.x86_64 (core-0)
           Requires: glibc-common = 2.17-55.el7
           Installed: glibc-common-2.17-106.el7_2.8.x86_64 (@updates)
               glibc-common = 2.17-106.el7_2.8
           Available: glibc-common-2.17-55.el7.x86_64 (core-0)
               glibc-common = 2.17-55.el7
Error: Package: glibc-common-2.17-106.el7_2.8.x86_64 (@updates)
           Requires: glibc = 2.17-106.el7_2.8
           Removing: glibc-2.17-106.el7_2.8.x86_64 (@updates)
               glibc = 2.17-106.el7_2.8
           Downgraded By: glibc-2.17-55.el7.x86_64 (core-0)
               glibc = 2.17-55.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
解决方案:降级yum downgrade glibc glibc-common(注意:这两个软件互相依赖,每次只降级一个会报错)
7、yum downgrade glibc glibc-common
8、yum install gcc
9、pecl install mongodb
提示:
configure: error: Cannot find OpenSSL's <evp.h>
ERROR: `/tmp/pear/install/mongodb/configure --with-php-config=/usr/bin/php-config' failed
解决方案:yum install openssl-devel
10、yum install openssl-devel
这里遇到了各种软件版本不一致,最终使用降级命令解决yum downgrade。有的时候只需要降级一个软件,有的时候需要同时降级多个软件
11、pecl install mongodb
终于成功了

1 0