We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Problem installing on Mac: fatal error: 'main/php.h' file not found

Setting up Phalcon on:

  • Mac 10.9.2
  • MAMP 3.3
  • PHP 5.5.10

I followed the instructions found here: https://dreamconception.com/tech/install-phalcon-with-mamp/

But when running the final step installing Phalcon I get the following error:

/Users/xyz/Downloads/cphalcon-master/build/64bits/phalcon.c:169:10: fatal error: 'main/php.h' file not found

Any clue how to get past that ?

Regards /sonny



22.6k

MAMP doesn't include the headers needed to build. If you have Xcode installed, you can use its PHP development environment by running this command in the terminal: ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include /Applications/MAMP/bin/php/php5.5.10

Change the PHP version and the OS version to the ones you're actually using.

edited Aug '15

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 php.net (https://www.php.net/releases/)
  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

Source: https://blog.akinyeleolubodun.com/solved-phalcon-framework-fatal-error-mainphp.h-file-not-found-when-creating-extension-from-c-source.html



67

Thanks Bodundun. Worked for me when I followed these steps.

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 php.net (https://www.php.net/releases/)
  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

Source: https://blog.akinyeleolubodun.com/solved-phalcon-framework-fatal-error-mainphp.h-file-not-found-when-creating-extension-from-c-source.html