I am running OSX El Capitan. I have installed the mongo driver using brew:
brew install php70-mongodb
The installation finished and it seems to work. When I do "php -m" on CLI it shows "mongo" installed. Running a script with Mongo driver works. The problem occurs when I am trying to run the same script through via Apache2. Then, I get an error that Mongo is not installed, due to the following line of code:
if (!extension_loaded('mongo')) die("MongoDB is not installed!");
phpinfo() indeed shows Mongo not being installed. I have created a php.ini file for apache using:
cp php.ini.default php.ini
and added the following line to the end of the file:
extension="/usr/local/opt/php56-mongo/mongo.so"
After restarting Apache, it still doesn't seem to load. I tried creating a copy of mongo.so in the same directory and give _www ownership (thought that may be the case), but still didn't work.
Strangely, the system tells me I have mail, which was sent from my Macbook to my Macbook, saying the following:
PHP Warning: PHP Startup: mongo: Unable to initialize module Module compiled with module API=20131226 PHP compiled with module API=20121212 These options need to match in Unknown on line 0
Any help on how to get the extension to load on Apache would be appreciated!......
extension
. It's at that location the same as you provided. – haxpor