Install the PHP driver module extension for MongoDB

This article is to record a few errors.

First download the mongo-php-driver, and you can’t configure directly without reading the readme. Error Cannot find php-config. Please use --with-php-config=PATH

To run phpize first, if not, install php5-dev.

Then follow the steps

    phpize
    ./configure
    make
    sudo make install


Then, add the following to your `php.ini` file:


    extension=mongo.so

The way to test the success is to go to phpinfo to see if the mongo module has been loaded, and the result is not.

In another way, delete what was added in php.ini just now, in

/etc/php5/mods-available/mongo.ini中添加下面代码
; configuration for php mongo module
; priority=30
extension=mongo.so

Then create link

cd ../cli/conf.d
sudo ln -s ../../mods-available/mongo.ini 30-mongo.ini
cd ../fpm/conf.d
sudo ln -s ../../mods-available/mongo.ini 30-mongo.ini
In fact, these two methods do the same thing.

The result is still not good, never come again, it failed when make test.

Later, make clean for a while, and start over again to get it done.

So I learned it again, make clean is to clear the object file (file with the suffix ".o") and executable file generated by the last make command.

Also, remember to restart the php5 service.

Guess you like

Origin blog.csdn.net/cscj2010/article/details/41443451