Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB PHP extension not recognized in command line script

I using a new server (Rackspace, Ubuntu 10.04) trying to run a php file via linux shell, and the file uses MongoDB to insert and store information being collected. I keep getting an error that is defined in the MongoDB library I am using: "The MongoDB PECL extension has not been installed or enabled"

When I run the same file/script in a browser window, it runs just fine.

A few things to note:

  • MongoDB php extension is installed and enabled (confirmed via phpinfo)
  • Using CodeIgniter with the MongoDB library found here: https://github.com/alexbilbie/codeigniter-mongodb-library
  • Using the CodeIgniter cron job bootstrapper extension found here: http://codeigniter.com/wiki/Cron_job_bootstrapper

I've used all of the above together on a previous, different server without issues.

I'm new to configuring a server 100% on my own, can anyone help me understand why the MongoDB PHP extension would not be recognized when run via shell, but work when accessed via http? Would it be an issue with my server configuration, or does the problem have to do with the libraries I am using?

like image 618
Jason Sack Avatar asked Jan 19 '23 11:01

Jason Sack


1 Answers

Ubuntu has two php.ini, one for Apache one for command line. If I remember correctly they are under:

/etc/php5/apache/..
/etc/php5/cli/...
like image 119
topek Avatar answered Jan 20 '23 23:01

topek