Search code examples
phpmongodbheader-filesphp-extension

Missing PHP includes (.h)


I am trying to install a PHP extension mongodb for non-default php binary location. I am using PECL:

sudo pecl install mongodb

and after long logs I get this

/tmp/pear/temp/mongodb/src/bson.c:29:17: fatal error: php.h: No such file or directory
 #include <php.h>
          ^
compilation terminated.
Makefile:338: recipe for target 'src/bson.lo' failed
make: *** [src/bson.lo] Error 1
ERROR: `make' failed

How can I get rid of this?

  • OS: Ubuntu 15.10
  • PHP Version: 5.6.10
  • /usr/include has no php.h
  • /usr/include/php5/include has no files
  • I have installed PHP via apt-get
  • I have installed and reinstalled php5-dev package

Solution

  • The same solution as here: Attempting to install OAuth on Ubuntu but getting errors

    Install the PCRE Library (Perl 5 Compatible Regular Expression Library) with:

    # sudo apt-get update
    # sudo apt-get install libpcre3 libpcre3-dev