suresh
suresh

Reputation: 2385

Error installing MongoDb PHP driver with XAMPP on Max OS Lion

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

Upvotes: 3

Views: 7203

Answers (4)

Ethan SK
Ethan SK

Reputation: 888

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

Upvotes: 1

Himanshu Pathak
Himanshu Pathak

Reputation: 193

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.

Upvotes: 0

aurora
aurora

Reputation: 9627

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

Upvotes: 12

Mark Hillick
Mark Hillick

Reputation: 6973

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.

Upvotes: 3

Related Questions