Unable to install mongodb php driver on mac os 10.9

前端 未结 5 568
眼角桃花
眼角桃花 2020-12-28 16:29

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         


        
相关标签:
5条回答
  • 2020-12-28 16:38

    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

    0 讨论(0)
  • 2020-12-28 16:39

    After upgrading to OS 10.9 I run into same issue. Try installing command line developer tools

    run

    xcode-select --install
    
    0 讨论(0)
  • 2020-12-28 16:43

    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
    
    0 讨论(0)
  • 2020-12-28 16:43

    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.

    0 讨论(0)
  • 2020-12-28 17:00

    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.

    0 讨论(0)
提交回复
热议问题