I've already installed mongoDB on my VPS. It works well.
Now I want to install php driver to make php work with mongoDB.
I followed Mongo Installation but cannot find information I need. This manual contains only this notice:
If you are using CentOS or Redhat, Csoke Arpad created » RPMs for these distributions (PHP Mongo).
I'm not familiar with ssh commands on CentOS and distributions (what is it?). Can anyone help me install this php extension? Please provide all ssh commands needed to install it.
Thank you.
If you have SSH access and root you should be able to follow the "Installing on *NIX" instructions (the RPMs are just created for convenience sake.)
You can try using pecl ... PECL is a repository for PHP Extensions and the mongo php driver uses that system.
Here is a blog post you might find helpful ...
http://learnmongo.com/posts/mongodb-php-install-and-connect/
Install instructions from that post ...
Command Line Install for Linux
Via your command line run pecl ... (if you use sudo):
$ sudo pecl install mongo
If you are already root ...
# pecl install mongo
If you get an error saying the system can’t find phpize
then you may need to install the PHP dev package (this is how you do if your OS has aptitude, you might need to use some other method to install the PHP dev packaes) …
$ sudo aptitude install php5-dev
You will then need to edit your php.ini file add add the mongo.so extension:
extension=mongo.so
Restart your webserver and you are done.
If pecl doesn't work for you, you can manually install it as described here ...
http://www.php.net/manual/en/mongo.installation.php#mongo.installation.manual
I just installed it on centos using:
yum install php-pecl-mongo
Don't forget to restart the server to start using it: service httpd restart
Try Justin's solution first with pecl (you'll want to use yum rather than aptitude to install php-devel), but if that doesn't work, I happen to have the manual build procedures on hand already for my own deploy reference. :)
Installing the PHP MongoDB driver
As root:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With