MongoDB client on CentOS / RedHat
The Mongo client can be installed through yum, simply add the MongoDB repository as described in the official manual.
I already explained this on other Linux distributions, here we go for CentOS and RedHat (maybe Slackware, too).
PHP Mongo extension
To install the Mongo extension for PHP, basically you’d do it via pecl:
sudo pecl install mongo
Or you can do it manually, which is essentially the same as what pecl and pear do!
tar xzf mongo-1.6.8.tgz
./configure --enable-mongo --with-php-config=php-config --prefix=/usr/lib/php5/
make && make install
Both, the database server+client and the PHP extension are required to be able to run queries against the MongoDB.
The code is updated quite often so it’s worth having a look from time to time.
I prefer using fresh code instead of LTS versions or packages built ages ago.