PHP, mongo.so failed to write PHP, mongo.so failed to write mongodb mongodb

PHP, mongo.so failed to write


I've solved this problem by changing extension_dir in php.ini.

Create a local extension dir and copy your existing extensions into

mkdir -p /usr/local/lib/php/extensionscp /usr/lib/php/extensions/no-debug-non-zts-20121212/* /usr/local/lib/php/extensions/

Update your php.ini, change the extension_dir and enable mongo:

extension_dir = "/usr/local/lib/php/extensions/"extension=mongo.so

Now the extension dir is writeable you can copy the mongo.so there.


Here's how to compile a mongo.so

wget http://pecl.php.net/get/mongotar xzvf mongocd mongo-1.6.12phpize./configure --with-php-config=/usr/bin/php-config --with-mongo-sasl=nomake

You can find the compiled library in .libs folder: .libs/mongo.soCopy it to extensions dir

cp .libs/mongo.so /usr/local/bin/php/extensions/

Finally, you can check whether it's working or not, by typing php -m | grep mongo in the command line.


Robert has solved this problem in this answer.stackoverflow.com/a/31884146.

Basically the issue is the El Capitan's Rootless feature. Its needs to be disabled in recovery mode, perform the pecl install and that enable it back again .

For some reason , pecl did not install it into my php extensions directly so, I had to copy the mongo extension pecl generated from the local library to my php extension folder xampp files for it to work