如何在 CentOS 5.3 上安装 php-mongo?

2022-01-13 00:00:00 mongodb centos php php-extension

我已经在我的 VPS 上安装了 mongoDB.效果很好.

I've already installed mongoDB on my VPS. It works well.

现在我想安装 php 驱动程序以使 php 与 mongoDB 一起工作.

Now I want to install php driver to make php work with mongoDB.

我关注了 Mongo 安装,但找不到我需要的信息.本手册仅包含此声明:

I followed Mongo Installation but cannot find information I need. This manual contains only this notice:

如果您使用的是 CentOS 或 Redhat,Csoke Arpad 会为这些发行版创建 » RPM(PHP Mongo).

If you are using CentOS or Redhat, Csoke Arpad created » RPMs for these distributions (PHP Mongo).

我不熟悉 CentOS 和发行版上的 ssh 命令(它是什么?).谁能帮我安装这个 php 扩展?请提供安装它所需的所有 ssh 命令.

I'm not familiar with ssh commands on CentOS and distributions (what is it?). Can anyone help me install this php extension? Please provide all ssh commands needed to install it.

谢谢.

推荐答案

先用 pecl 试试 Justin 的解决方案(你会想用 yum 而不是 aptitude 来安装 php-devel),但如果这不起作用,我碰巧手头已经有手动构建程序供我自己的部署参考.:)

Try Justin's solution first with pecl (you'll want to use yum rather than aptitude to install php-devel), but if that doesn't work, I happen to have the manual build procedures on hand already for my own deploy reference. :)

安装 PHP MongoDB 驱动程序

作为根:

  1. 导出 PHP_AUTOCONF=/usr/bin/autoconf
  2. 导出 PHP_AUTOHEADER=/usr/bin/autoheader
  3. wget http://pecl.php.net/get/mongo-1.0.9.tgz
  4. tar -xzf mongo-1.0.9.tgz
  5. cd mongo-1.0.9
  6. php化
  7. ./配置
  8. 制作 &&进行安装
  9. 到/etc/php.d/mongo.ini,添加:extension=mongo.so

相关文章