mongo.so not working with PHP on my server

Hi there,

I have MongoDB installed on my server. It works, but I am having a very tough time with inclusion of the mongo.so extension for PHP.

- I've upgraded my php to the latest version (but it also didn't work on the 5.2.x)
- I've used the pecl mongo install and uninstall command many times
- I've made sure that the mongo.so is in the correct inclusion directory for PHP extensions
- i've added the extension=mongo.so to my correct php.ini file.
- I've also tried the manual complie of the driver

When i try phpinfo(); the mongo extension is simply not there. But it is interesting that i see the mongo module if i run php -m on the server. weird right!

Im on CentOS, using Apache 2.2 with php 5.3.8

Thank you
xNejXAsked:
Who is Participating?
 
xNejXConnect With a Mentor Author Commented:
Well, after compiling the extension about 80 times I've decided to check if the extension path can be relative as it currently was set in the php.ini:

extension_dir = "./"

Open in new window


it turns out that php doesn't quite understand relative paths in its configuration files, so by simply changing the extension dir to the absolute location solved my problem:

extension_dir = "/usr/local/lib/"

Open in new window


even though the php.ini file was located in the /usr/local/lib/ directory i guess it still needs the path to be relative. This extension_dir = "./" is a generic config in the directadmin control panel so do be careful.

0
 
Jayachandran PalanisamyConnect With a Mentor Technical Consultant - LinuxCommented:
Hi,
Please let me know the following outputs.

php -i |grep php.ini
php -m |grep mongo

Which line you have added into your php.ini file?

-Jay
0
 
xNejXAuthor Commented:
Hi,

this is the output. I am using the correct php.ini file. I've added the extension=mongo.so, which is located in the correct folder for extensions.

[root@server lib]# php -i |grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

Open in new window


[root@streznik87 lib]# php -m |grep mongo
mongo

Open in new window


Thank you for your help.


0
 
xNejXAuthor Commented:
I figured it out by myself
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.