Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.

[SOLVED] Phalcon Framework "fatal error: 'main/php.h' file not found" when creating extension from C source

I am trying to setup PHP Falcon framework on a MAC and ran into a little problem when creating the extension from C source.

After my git clone (git clone --depth=1 git://, changing directory to cphalcon/build and running sudo ./install gave an error:

/Users/<username>/Downloads/cphalcon/build/64bits/phalcon.c:169:10: fatal error: 'main/php.h' file not found

To solve this, follow the following steps:

1. MAMP doesn't provide the source code archive for PHP 5.x.xx, so download it from

2. Extract the source code archive to /Applications/MAMP/bin/php/php5.x.xx/include/php

3. Change directory into /Applications/MAMP/bin/php/php5.x.xx/include/php i.e cd /Applications/MAMP/bin/php/php5.x.xx/include/php

4. Run ./configure (i.e type ./configure on your terminal and press Enter) to configure the source code for your platform (this would enable it see the bunch of header files)

5. Re-try sudo ./install

Hope this helped someone stay out of trouble.

comments powered by Disqus