After googling for about an hour can\'t find any solution that works for me. I\'m on OS X 10.9 Mavericks.
Here is what the terminal says:
$ sudo pecl
If the solution by Janis Lankovskis did not work out.. then it seems like your PHP installation is weirdly broken..
How did you install PHP in the first place?
The main problem here is the phpize
command, which seems to exist but if failing miserably (I don't know why pecl
continues.. that seems weird).
I'd re-install PHP, and make sure the header files are available - and in case you have multiple installations then make the path of the phpize
command for your "currently active" PHP installation the first path in your $PATH
After upgrading to OS 10.9 I run into same issue. Try installing command line developer tools
run
xcode-select --install
Here is how I solved this after installing Xcode:
cd /usr/include
sudo ln -sf /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/php
I found this article very helpful. Saved a lot of time after I wasted a lot of time to check other links.
The thing is MAMP does not ship with all PHP sources to compile pecl mongo file and create mongo.so. All what you need is download php for respective version you are using. I was using php version 5.6.10
. I checked php.net site that was having 5.6.13
version. I downloaded sources for this version from PhP.net. Executed "sudo pecl install mongo
" again and it worked.
This worked for me:
$ brew tap homebrew/php
$ brew install php56-mongodb
Then add this to your php.ini
extension='/usr/local/opt/php56-mongodb/mongodb.so'
Notice that I am installing "php56-mongodb" and also linking to the same on php.ini. You can change that to your preferred php version.