PHP中的Mongodb连接不起作用

2022-01-14 00:00:00 mongodb linux xampp php

我正在使用 Ubuntu 12.04 LTS 并在 /opt/lampp/bin/ 中安装了 pecl.

I am using Ubuntu 12.04 LTS and installed pecl in /opt/lampp/bin/ .

第二次安装时抛出错误-

When installing second time its throwing error -

之前运行的命令 -

pecl install mongo

pecl/mongo 已经安装,和发布的一样1.5.1版安装失败

pecl/mongo is already installed and is the same as the released version 1.5.1 install failed

现在当我检查时 -

echo extension_loaded("mongo") ?"已加载 " : "未加载 ";

echo extension_loaded("mongo") ? "loaded " : "not loaded ";

显示未加载.

但是我用 extension=mongo.so 更新了 php.ini 并重新启动了服务器,但它不起作用.

However I updated the php.ini with extension=mongo.so and restarted the server, but its not working.

现在让我看看我做错了什么.

Let me now what I am doing wrong.

编辑

我重新实例化了命令,结果如下-

I re instantiated the command and following is the outcome -

Build process completed successfully
Installing '/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so'
install ok: channel://pecl.php.net/mongo-1.5.1
configuration option "php_ini" is not set to php.ini location
You should add "extension=mongo.so" to php.ini

推荐答案

终于在Neil Lunn的帮助下我做对了.

Finally with the help of Neil Lunn I made it the right way.

我添加了完整路径,并在我的 php.ini

I added the full path and added the code at the very last line of my php.ini

extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so"

extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/mongo.so"

相关文章