Problem compiling mongo.so

780 views
Skip to first unread message

Morgan Fromentin

unread,
Sep 28, 2015, 4:38:24 PM9/28/15
to mongodb-user
Hi there,

I've been fighting to compile my mongo.so in order to use mongoDB in php (5.4.10 installed with MAMP).
I run the

pecl install mongo

command, but I only get the following error :

/private/tmp/pear/temp/mongo/php_mongo.c:16:10: fatal error: 'php.h' file not found
#include <php.h>
         ^
1 error generated.
make: *** [php_mongo.lo] Error 1
ERROR: `make' failed

I read somewhere that it could be fixed with an "xcode-select --install" but I only get :

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Any idea ? Please :)

Thanks in advance

Jeremy Mikola

unread,
Sep 28, 2015, 4:59:57 PM9/28/15
to mongod...@googlegroups.com
On Mon, Sep 28, 2015 at 4:06 PM, Morgan Fromentin <morgan.f...@gmail.com> wrote:
Hi there,

I've been fighting to compile my mongo.so in order to use mongoDB in php (5.4.10 installed with MAMP).
I run the

pecl install mongo

command, but I only get the following error :

/private/tmp/pear/temp/mongo/php_mongo.c:16:10: fatal error: 'php.h' file not found
#include <php.h>
         ^
1 error generated.
make: *** [php_mongo.lo] Error 1
ERROR: `make' failed

Did you confirm that PHP's development headers are available? On Linux, this might be something like a php5-dev package in one's package manager.

If this is all being handled with MAMP, did you confirm that you're using the version of PECL and phpize that ships with MAMP?
 

I read somewhere that it could be fixed with an "xcode-select --install" but I only get :

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

AFAIK, that is mentioned in the OSX install docs to ensure certain Xcode developer tools are available -- I'm not sure that's related to the PHP development headers missing.
 

Stephen Steneker

unread,
Sep 28, 2015, 10:04:29 PM9/28/15
to mongodb-user
On Tuesday, 29 September 2015 06:38:24 UTC+10, Morgan Fromentin wrote:
I've been fighting to compile my mongo.so in order to use mongoDB in php (5.4.10 installed with MAMP).

Hi Morgan,

As noted by Jeremy, you need to install the PHP development headers matching the version you are trying to compile the extension for.

MAMP does not include the dev headers, so you need to download the right source from php.net:  http://php.net/releases/#5.4.10.


Given PHP 5.4.10 was released in Dec-2012, I would definitely consider upgrading to a newer version of MAMP & PHP ;-).

Regards,
Stephen

Morgan Fromentin

unread,
Sep 29, 2015, 6:45:36 AM9/29/15
to mongodb-user
OK guys,

thanks to your info, I downloaded the sources, ran the command again, and one more problem :

fatal error: 'zend.h' file not found

After some research, all seems good. mongo appears in php, and no error in php_error.log.

Thank you so much, you saved me so many headaches.

Next step : upgrade MAMP !
Reply all
Reply to author
Forward
0 new messages