web-dev-qa-db-fra.com

Impossible d'installer le pilote phong mongodb sur mac os 10.9

Après avoir googlé pendant environ une heure, je ne trouve aucune solution qui me convienne. Je suis sur OS X 10.9 Mavericks.

Voici ce que dit le terminal:

$ Sudo pecl install mongo

downloading mongo-1.4.4.tgz ...
Starting to download mongo-1.4.4.tgz (141,242 bytes)
..............................done: 141,242 bytes
84 source files, building
running: phpize
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
building in /private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4
running: /private/tmp/pear/install/mongo/configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i386-Apple-darwin13.0.0
checking Host system type... i386-Apple-darwin13.0.0
checking target system type... i386-Apple-darwin13.0.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable Mongo extension... yes, shared
checking whether byte ordering is bigendian... no
checking whether to compile for recent osx architectures... yes
checking whether to include code coverage symbols... no
checking Build with PHP streams support... yes
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/libtool --mode=compile cc -I./util -I. -I/private/tmp/pear/install/mongo -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/include -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/main -I/private/tmp/pear/install/mongo -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/util -I/private/tmp/pear/install/mongo/util -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/exceptions -I/private/tmp/pear/install/mongo/exceptions -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/gridfs -I/private/tmp/pear/install/mongo/gridfs -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/types -I/private/tmp/pear/install/mongo/types -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/mcon -I/private/tmp/pear/install/mongo/mcon  -
DHAVE_CONFIG_H  -g -O2 -Arch i386 -Arch x86_64 -mmacosx-version-min=10.5   -c /private/tmp/pear/install/mongo/php_mongo.c -o php_mongo.lo
mkdir .libs
 cc -I./util -I. -I/private/tmp/pear/install/mongo -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/include -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/main -I/private/tmp/pear/install/mongo -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/util -I/private/tmp/pear/install/mongo/util -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/exceptions -I/private/tmp/pear/install/mongo/exceptions -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/gridfs -I/private/tmp/pear/install/mongo/gridfs -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/types -I/private/tmp/pear/install/mongo/types -I/private/tmp/pear/install/pear-build-rootDzh2iw/mongo-1.4.4/mcon -I/private/tmp/pear/install/mongo/mcon -DHAVE_CONFIG_H -g -O2 -Arch i386 -Arch x86_64 -mmacosx-version-min=10.5 -c /private/tmp/pea
r/install/mongo/php_mongo.c  -fno-common -DPIC -o .libs/php_mongo.o
/private/tmp/pear/install/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

Peut-être que quelqu'un a déjà rencontré ce problème et connaît une solution?

20

Après la mise à niveau vers OS 10.9, je rencontre le même problème. Essayez d’installer des outils de développement pour les lignes de commande.

courir 

xcode-select --install
41
Janis Lankovskis

Voici comment j'ai résolu ceci après avoir installé Xcode:

cd /usr/include
Sudo ln -sf /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/php
9
Ahmadster

Si la solution de Janis Lankovskis n'a pas fonctionné .. il semble alors que votre installation de PHP est étrangement endommagée ..

Comment avez-vous installé PHP en premier lieu?

Le problème principal ici est la commande phpize, qui semble exister, mais qui échoue lamentablement (je ne sais pas pourquoi pecl continue .. cela semble étrange).

Je réinstallerais PHP et m'assurerais que les fichiers d'en-tête sont disponibles. Si vous avez plusieurs installations, indiquez le chemin de la commande phpize pour votre installation "actuellement active" PHP en premier votre $ PATH

1
bjori

J'ai trouvé cet article très utile . J'ai gagné beaucoup de temps après avoir perdu beaucoup de temps à vérifier d'autres liens. 

Le problème est que MAMP n’est pas livré avec toutes les sources PHP pour compiler le fichier pecl mongo et créer mongo.so. Tout ce dont vous avez besoin est de télécharger php pour la version que vous utilisez. J'utilisais la version php 5.6.10. J'ai vérifié le site php.net qui avait la version 5.6.13. J'ai téléchargé les sources de cette version à partir de PhP.net . Exécutez "Sudo pecl install mongo" à nouveau et cela a fonctionné. 

0
Himanshu Pathak

Cela a fonctionné pour moi:

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

Puis ajoutez ceci à votre php.ini

extension = '/ usr/local/opt / php56-mongodb / mongodb.so'

Notez que j'installe "php56-mongodb" et que je crée un lien vers le même sur php.ini. Vous pouvez changer cela pour votre version php préférée.

0
TechyTimo