Unable to install mongodb php driver on mac os 10.9

15,500

Solution 1

After upgrading to OS 10.9 I run into same issue. Try installing command line developer tools

run

xcode-select --install

Solution 2

Here is how I solved this after installing Xcode:

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

Solution 3

If the solution by Janis Lankovskis did not work out.. then it seems like your PHP installation is weirdly broken..

How did you install PHP in the first place?

The main problem here is the phpize command, which seems to exist but if failing miserably (I don't know why pecl continues.. that seems weird).

I'd re-install PHP, and make sure the header files are available - and in case you have multiple installations then make the path of the phpize command for your "currently active" PHP installation the first path in your $PATH

Share:
15,500

Related videos on Youtube

Iliz
Author by

Iliz

Updated on September 08, 2020

Comments

  • Iliz
    Iliz over 3 years

    After googling for about an hour can't find any solution that works for me. I'm on OS X 10.9 Mavericks.

    Here is what the terminal says:

    $ 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
    

    Maybe someone has already encountered this problem and knows a solution?

    • Philipp
      Philipp over 10 years
      Welcome to stackoverflow.com. Unfortunately your question is not a good fit for this website, because stackoverflow is about programming problems only. There are, however, several other websites of the stackexchange network where your question would be much more appropriate.
    • Mick Sear
      Mick Sear over 10 years
      @Philipp, although this is clearly to do with installing software, I don't agree that the question is not a good fit for this site. After all, the software being installed will be for development purposes on that platform, and it very relevant to other developers upgrading to Mavericks on Mac.
  • Beshoy Girgis
    Beshoy Girgis over 10 years
    "Can't install the software because it is not currently available from the Software Update server."
  • chopper
    chopper over 10 years
    I second @JohnJ.Camilleri. This worked perfectly for me after upgrading to OSX Mavericks
  • Kell
    Kell over 10 years
    You my friend, are a god.
  • firebear
    firebear almost 10 years
    yes, It solved my problem in my OS 10.9.3! thanks a lot
  • 0x1gene
    0x1gene over 9 years
    ln: ./php: Operation not permitted
  • Ricardo Martins
    Ricardo Martins over 9 years
    Solved for me on Yosemite 10.10.1 too. Thank you.
  • Hayk Aramyan
    Hayk Aramyan almost 9 years
    @Ahmadster what if we get ./php: Operation not permitted ?
  • Tim Truston
    Tim Truston over 6 years
    "xcode-select: error: command line tools are already installed, use "Software Update" to install updates"
  • Matt
    Matt about 6 years
    This got me past the missing php.h file, but then it got stuck looking for openssl.h. Running the following command worked. sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include pecl install mongodb
  • CORSAIR
    CORSAIR over 4 years
    the article url is broken or not relevant anymore