无法修复PHP致命错误:找不到类'MongoPool'

时间:2012-10-22 00:20:33

标签: mongodb nginx php

很遗憾,我无法解决Class 'MongoPool' not found错误。重新检查配置中的所有内容,一切看起来都很正常:(已花了4个小时就已经:(

我正在使用:

  • Ubuntu 12.04
  • nginx 1.1.19
  • php 5.3.10-1ubuntu3.4 as php-fpm extension to nginx
  • mongodb driver 1.3.0RC1-dev

配置信息:

  • 我的phpinfo()输出是 here
  • nginx.conf here
  • fastcgi_params here
  • php.ini here
  • php-fpm.conf here
php文件夹中的

mongo.ini就是这个

extension=mongo.so
mongo.native_long = true
mongo.utf8 = 1

/etc/php5/fpm/pool.d/www.conf也很短

[www]

user = www-data
group = www-data
listen = /var/run/php-fpm.sock
pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6
access.log = /var/www/log/$pool.access.log
;chroot = /var/www/
chdir = /

你能看一下我的配置并帮助我吗?

测试页面是这个

<?php
MongoPool::setSize(2);
?>

nginx服务器的配置是

server {
    root /usr/share/nginx/www;
    index index.php index.html index.htm;

    server_name localhost 192.168.1.149;

    location / {
        try_files $uri $uri/ /index.html;
    }

    location /doc/ {
        alias /usr/share/doc/;
        autoindex on;
        allow 127.0.0.1;
        deny all;
    }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

来自nginx的日志片段

2012/10/21 06:35:48 [error] 21418#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'MongoPool' not found in /usr/share/nginx/www/test2.php on line 2
PHP message: PHP Stack trace:
PHP message: PHP   1. {main}() /usr/share/nginx/www/test2.php:0" while reading response header from upstream, client: 192.168.1.2, server: localhost, request: "GET /test2.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm.sock:", host: "192.168.1.149"

1 个答案:

答案 0 :(得分:1)

正如用户 eicto 暗示,MongoDb Driver for PHP的创建者大约2个月前从驱动程序的主干版本中删除了此类(请参阅 this commit )。

  

我们将添加MongoPool和其他几种方法以实现向后兼容,但他们不会做任何事情而只是发出E_DEPRECATED警告

使用开发版本时要小心。