Error installing MongoDb PHP driver with XAMPP on Max OS Lion

限于喜欢 提交于 2019-12-22 09:46:56

问题


I get this error when i try to run following command sudo pecl install mongo

Error:

...php_mongo.c:22:10: fatal error: 'php.h' 
file not found 
  #include <php.h> 
         ^ 
  1 error generated. 
  make: *** [php_mongo.lo] Error 1 
  ERROR: `make' failed 

I am new to MAC, please help me to resolve this and get Mongo Working with PHP.

I have installed MacPorts and autoconf


回答1:


It seems, that you did not install the xampp "Developer Package", required to build additional php extension. You can download the "Developer Package" from:

http://www.apachefriends.org/en/xampp-macosx.html#849




回答2:


This has already been answered.

Please follow the processes outlined in this answer - Install PECL on Mac OS X 10.6.

I followed the process outlined here http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/, referenced by the above Stackoverflow link and the process for install pear, followed by pecl and subsequently -

sudo pecl install mongo

works perfectly on OSX Lion.

You may need to modify the extensions in /etc/php.ini, however, this is explained in the output after you install the php mongo driver.




回答3:


It took me the whole day to find this answer, I had tried everything, but this worked finally:

    sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include /Applications/XAMPP/xamppfiles/bin/pecl install mongodb



回答4:


I found this article very helpful. Saved a lot of time after I wasted a lot of time to check other links. I did for MAMP and think will work for XAMPP too.

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.



来源:https://stackoverflow.com/questions/10725577/error-installing-mongodb-php-driver-with-xampp-on-max-os-lion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!