5

I am having trouble installing the new mongoldb driver for PHP on MAMP 3.5 OS X El Capitan. I entered the PATH to the MAMP's php7 binaries. I have also downloaded php7 sources, unarchive and in /Applications/MAMP/bin/php/php7.0.0/ I have created a directory include where I moved the downloaded php source (renamed the containing directory as 'php'). So now I have /Applications/MAMP/bin/php/php7.0.0/include/php in addition to MAMP original files. I am not sure if I push something forward or not. When I run

sudo pecl install mongoldb

I've got the error bellow:

downloading mongodb-1.1.1.tgz ...
Starting to download mongodb-1.1.1.tgz (642,977 bytes)
.................................................................................................................................done: 642,977 bytes
349 source files, building
running: phpize
Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012
cp: acinclude.m4: No such file or directory
cp: Makefile.global: No such file or directory
cp: config.sub: No such file or directory
cp: config.guess: No such file or directory
cp: ltmain.sh: No such file or directory
cp: run-tests*.php: No such file or directory
cat: acinclude.m4: No such file or directory
/Applications/MAMP/bin/php/php7.0.0/bin/phpize: line 155: /Applications/MAMP/bin/php/php7.0.0/lib/php/build/phpize.m4: No such file or directory
autoconf: error: no input file
ERROR: `phpize' failed

Does anybody managed to install the new mongodb php driver on MAMP on OS X? Do I make somethings wrong? Any suggestions?

Some links: http://mongodb.github.io/mongo-php-driver/#installation, https://github.com/mongodb/mongo-php-driver, https://pecl.php.net/package/mongodb

Thanks.

Andrea
  • 19,134
  • 4
  • 43
  • 65
Florin Sima
  • 1,495
  • 17
  • 13

2 Answers2

8

It seems that MAMP 3.5's PHP 7.0.0 version is missing the build directory in the associated lib/php directory, which is why you're getting the error:

/Applications/MAMP/bin/php/php7.0.0/lib/php/build/phpize.m4: No such file or directory

Just copy the build directory from one of the other PHP versions, e.g. /Applications/MAMP/bin/php/php5.6.10/lib/php/build to /Applications/MAMP/bin/php/php7.0.0/lib/php/build.

I've installed a few PECL modules with this fix and they're working fine.

Hopefully this is just a mistake in the MAMP packaging and will be fixed in versions after 3.5.

Talis
  • 111
  • 1
  • thank you. Also i have noticed that build from original php doesnt work, but from older MAMP's php works for me. – fdrv Mar 21 '16 at 01:11
  • This saved me. Like the other commenter I couldn't get my module built even with the original sources from PHP.net. The MAMP 5.6 files worked fine however. In my case I was installing Redis from PECL. – Mark Thomson Jun 17 '16 at 00:13
1

I had the same issue and this worked best for me:

$ brew tap homebrew/homebrew-php
$ brew install php70-mongodb

You'll need to update php.ini and add the following line:

extension="/usr/local/opt/php70-mongodb/mongodb.so"

Restart MAMP servers, and you're done!

Michael
  • 1,058
  • 10
  • 17