PHP 5.5 是否适用于 MongoDB 驱动程序? [英] Does PHP 5.5 work with MongoDB driver?

查看:50
本文介绍了PHP 5.5 是否适用于 MongoDB 驱动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 PHP 5.5,但无法再使用 MongoClient,我很沮丧地想找出原因.

I've just installed PHP 5.5 and I am no longer able to use MongoClient and I'm getting frustrated trying to figure out why.

这不起作用:

$m = new MongoClient("mongodb://workplz.com");

我的 nginx 错误日志显示:

My nginx error log shows:

2013/07/05 10:40:16 [错误] 4163#0:*698 FastCGI 发送到标准错误:PHP 消息:PHP 致命错误:在线/blah/test.php 中找不到类‘MongoClient’2"同时从上游读取响应头,客户端:123.123.123.123,服务器:等等,请求:GET/test.php HTTP/1.1",上游:fastcgi://unix:/var/lib/php5-fpm/freecookies.sock:", 主机: "blah"

2013/07/05 10:40:16 [error] 4163#0: *698 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'MongoClient' not found in /blah/test.php on line 2" while reading response header from upstream, client: 123.123.123.123, server: blah, request: "GET /test.php HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/freecookies.sock:", host: "blah"

我的 php.ini 中有 extension=mongo.so.

I do have extension=mongo.so in my php.ini.

当我执行 phpinfo() 时,它显示在 Mongo Version 1.4.1

When I do phpinfo() it shows under Mongo Version 1.4.1

额外信息:

  • PHP 版本 5.5.0-1ubuntu2~precise1
  • nginx/1.4.1

当我尝试从 php-cli 执行它时,我得到同样的结果:

When I try to execute it from php-cli I get the same thing:

PHP 致命错误:在第 2 行的/blah/test.php 中找不到MongoClient"类

推荐答案

仔细检查你的 php.ini,你可能使用了错误的.有几种不同的方式来调用 PHP.

Double check your php.ini, you're probably using the wrong one. There are several for different ways to invoke PHP.

这篇关于PHP 5.5 是否适用于 MongoDB 驱动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆