[英]Mongo / PHP wrapper error - how do i get the wrapper working?
我在尝试连接到mongo服务器时遇到此错误:
Unable to find the wrapper "mongodb" - did you forget to enable it when you configured PHP?
连接字符串如下所示:
$conn = new Mongo("mongodb://XXXX:XXXX@XXX.member0.mongohq.com:10021/XXX",array("replicaSet" => 'rsname'));
我尝试使用以下方法找出qhat包装器:
var_dump(stream_get_wrappers());
并得到以下:
array
0 => string 'https' (length=5)
1 => string 'ftps' (length=4)
2 => string 'compress.zlib' (length=13)
3 => string 'compress.bzip2' (length=14)
4 => string 'php' (length=3)
5 => string 'file' (length=4)
6 => string 'glob' (length=4)
7 => string 'data' (length=4)
8 => string 'http' (length=4)
9 => string 'ftp' (length=3)
10 => string 'phar' (length=4)
11 => string 'zip' (length=3)
12 => string 'ssh2.shell' (length=10)
13 => string 'ssh2.exec' (length=9)
14 => string 'ssh2.tunnel' (length=11)
15 => string 'ssh2.scp' (length=8)
16 => string 'ssh2.sftp' (length=9)
我已经检查了conf.d文件夹,它们似乎都是我能看到的顺序,所以我不知道我需要做什么来允许我使用包装器连接,如php中的示例所示docs例子。
我正在运行nginx / PHP 5.3.5-1ubuntu7.11
哈有人在此之前解决这个问题,还是能够提供一些指导? 谢谢。
您使用的是哪个版本的Mongo php库? 我使用版本1.2.12进行了这样一个简单的测试:
<?php
$mongo = new Mongo('mongodb://host1.local:27019,host2.local:27020', array("replicaSet"=>'aaa'));
$hosts = $mongo->getHosts();
var_dump( $hosts );
?>
并且完全没问题。 自请求PHP-121返回1.0.9版本以来,可以通过php驱动程序获得ReplicaSet支持
为了更具体地回答你的问题,mongo php驱动程序不使用连接包装器。 它有一个连接解析器。 您可以在代码本身中找到更多详细信息: parser.c
PS:你的ubuntu版本有点老了! 于2007年10月发布并于2009年4月达到EOL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.