简体   繁体   中英

executing php script on console

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM