2

I have a php script, and I am trying to run it on my linux console. I can run it with curl and on any browser wtihout any errors. This is the error I am getting.

PHP Fatal error:  Class 'Mongo' not found in .....

Fatal error: Class 'Mongo' not found in ....

I have no idea why I am getting this error, thank you

9
  • 6
    With what you have given me, i would assume that Class 'Mongo' can not be found Commented Feb 18, 2013 at 19:45
  • 1
    You need to install the driver Commented Feb 18, 2013 at 19:46
  • 3
    Mongo is out hunting buffalo at the moment, but if you leave a message ... Commented Feb 18, 2013 at 19:47
  • 1
    what command are you using to run the script on console? Commented Feb 18, 2013 at 19:50
  • 2
    You should add extension=mongo.so to your /etc/php5/cli/php.ini file Commented Feb 18, 2013 at 19:56

2 Answers 2

3

You should add extension=mongo.so to your /etc/php5/cli/php.ini file

You can run following command to identify which ini file your php version using:

vps01:/usr/share/php# php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Sign up to request clarification or add additional context in comments.

6 Comments

this one solved the problem :) I did not know apache and client uses different drivers :) thank you
@Satish You "should" should you? What about the more detailed answer below? You put an answer that any of us could have, you didn't even explain why it works...for all we know you don't actually know why it works you just plucked the info from the comments above....
In rush of get first answer! I made it short.. my bad :(
Loaded Configuration File: /etc/php5/cli/php.ini
Just after the answer, i saw green answer flag in my answer and suddenly it disappear :(
|
2

It happens because php uses different configurations for web-server and CLI. Often the CLI config is placed in /etc/php5/cli/. Compare it with your general php.ini file and you will find what causes the error.

1 Comment

thank you :) now I know apache and client uses different drivers :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.