- Fatal error php h no such file or directory
- Installing XDebug
- The Mojave Solution
- The Catalina Issue
- References for later
- Saved searches
- Use saved searches to filter your results more quickly
- fatal error: php.h: No such file or directory #13
- fatal error: php.h: No such file or directory #13
- Comments
- Saved searches
- Use saved searches to filter your results more quickly
- Compilation Error #42
- Compilation Error #42
- Comments
- Saved searches
- Use saved searches to filter your results more quickly
- Cannot compile with PHP 5.5 #33
- Cannot compile with PHP 5.5 #33
- Comments
Fatal error php h no such file or directory
In the last post, I was finally back up and running with my IDE after an update to Serenata. Or maybe not.
Turns out, another update broke something. MacOS Catalina was released recently and introduced a new version of PHP (7.3.8 in my case). This change means XDebug is now referencing outdated Zend API, which throws an error when running pretty much anything. Oops, beause no XDebug egals no PHPUnit code coverage report.
On MacOS Mojave, getting XDebug was a matter of installing Pear, setting up some Xcode SDK Headers file, installing XDebug from source using Pear and enabling XDebug in PHP configuration files. Sounds easy, should be the same for Catalina.
Spoiler alert, Xcode 11 comes with a massive breaking change.
An alternative installation method is to use homebrew to install PHP, Pecl and XDebug. I didn’t test this method, as I prefer the long method which was simple to setup on Mojave. Plus, solving this issue might prove useful for other situations.
Installing XDebug
Assuming Pear, Autoconf, and Xcode is installed on your computer, installing XDebug should be easy as :
But now, I’m getting the following error. This is because the compiler requires some header files, which are provided by the MacOS SDK bundled with Xcode. Not a surprise, as it was the same error with previous version of MacOS, aka Mojave :
/private/tmp/pear/install/xdebug/xdebug.c:25:10: fatal error: 'php.h' file not found #include "php.h" ^~~~~~~ 1 error generated. make: *** [xdebug.lo] Error 1 ERROR: `make' failed
The Mojave Solution
On Mojave, the following step was necessary to install the missing header files. Don’t actually run this command on Catalina, as it will fail.
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
The problem is the SDK headers package was removed starting with Xcode 11.0. And we can’t just change 10.14 to 10.15 to make it work.
The Catalina Issue
After a lot of digging, I’ve found the actual files are actually stored somewhere :
$ sudo find /Library -name php.h /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/php/main/php.h /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/php/main/php.h
$ sudo pecl install xdebug downloading xdebug-2.7.2.tgz . Starting to download xdebug-2.7.2.tgz (230,987 bytes) . done: 230,987 bytes 69 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
See the error returned by phpize claiming /usr/include/php/main/php.h doesn’t exist? Turns out, /usr/include doesn’t actually exist on my system:
$ ls /usr/include ls: /usr/include: No such file or directory
If you try to symlink one into the other, even using sudo, that won’t work, thanks to SIP :
$ sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include /usr/include ln: /usr/include: Operation not permitted
The reason is Apple has deprecated having a /usr/include distinct from the SDK. This has been completely removed in Catalina so different SDK and Xcode version could be run together.
So now the issue is, in order to compile XDebug, we need to either tell the compiler to use the headers from a different location, or actually put the required files in /usr/include .
Until this issue is resolved, either on Apple side or XDebug side, not much can be done other than use a VM to run tests locally.
References for later
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fatal error: php.h: No such file or directory #13
fatal error: php.h: No such file or directory #13
Comments
This seems to be related to missing php-dev. I have php installed from source.
cd src; make make[1]: Entering directory `/usr/local/src/PHP-CPP/src' g++ -g -Wno-write-strings -c -I. -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/ext -I/usr/include/php5/Zend -I/usr/include/php5/TSRM -O2 -std=c++11 -fpic -o argument.o argument.cpp In file included from argument.cpp:9:0: includes.h:33:17: fatal error: php.h: No such file or directory compilation terminated. make[1]: *** [argument.o] Error 1 make[1]: Leaving directory `/usr/local/src/PHP-CPP/src' make: *** [all] Error 2
The text was updated successfully, but these errors were encountered:
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation Error #42
Compilation Error #42
Comments
I am having this issue when trying to compile my project:
# github.com/deuill/go-php src/github.com/deuill/go-php/context.go:11:23: fatal error: main/php.h: No such file or directory // #include ^ compilation terminated.
Could this be because I set up the project incorrectly or another reason
The text was updated successfully, but these errors were encountered:
I moved everything up one directory because for some reason all my php files were stored in /usr/include/php/20151012. But now I am getting the following error:
/usr/bin/ld: cannot find -lphp7 collect2: error: ld returned 1 exit status
Try building with the debian tag:
go get -u -v -tags 'php7 debian' github.com/deuill/go-php
I’m still getting the ld returned 1 error.
Is it possible that you haven’t installed the right package? You’d need to install libphp-embed .
steps I had to follow to install under ubuntu:
apt-get install libphp7.0-embed
go get -u -v -tags ‘php7 debian’ github.com/deuill/go-php
on compile I still was getting error. had to change context.go(I took those definitions from php7-debian):
-// #cgo CFLAGS: -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM
-// #cgo CFLAGS: -I/usr/include/php/Zend -Iinclude
+// #cgo CFLAGS: -I/usr/include/php/20151012 -Iinclude/php7 -Isrc/php7
+// #cgo CFLAGS: -I/usr/include/php/20151012/main -I/usr/include/php/20151012/Zend
+// #cgo CFLAGS: -I/usr/include/php/20151012/TSRM
+// #cgo LDFLAGS: -lphp7.0
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
eaccelerator / eaccelerator Public archive
Cannot compile with PHP 5.5 #33
Cannot compile with PHP 5.5 #33
Comments
eaccelerator.c:66:23: error: php_logos.h: No such file or directory
Checking the php-5.5.0/UPGRADING:
The text was updated successfully, but these errors were encountered:
It won’t work with 5.5 anyway, so just use the bundled Zend OpCache instead.
I patched it a bit with some #if statements around offending pieces of code. The #include and also calls to php_register_info_logo()
@@ -63,7 +63,9 @@ #include "php.h" #include "php_ini.h" -#include "php_logos.h" +#if PHP_VERSION_ID 50500 +# include "php_logos.h" +#endif #include "main/fopen_wrappers.h" #include "ext/standard/info.h" #include "ext/standard/php_incomplete_class.h" @@ -2269,8 +2271,10 @@ > > - php_register_info_logo(EACCELERATOR_VERSION_GUID, "text/plain", (unsigned char*)EACCELERATOR_VERSION_STRING, sizeof(EACCELERATOR_VERSION_STRING)); - php_register_info_logo(EACCELERATOR_LOGO_GUID, "image/gif", (unsigned char*)eaccelerator_logo, sizeof(eaccelerator_logo)); + #if PHP_VERSION_ID 50500 + php_register_info_logo(EACCELERATOR_VERSION_GUID, "text/plain", (unsigned char*)EACCELERATOR_VERSION_STRING, sizeof(EACCELERATOR_VERSION_STRING)); + php_register_info_logo(EACCELERATOR_LOGO_GUID, "image/gif", (unsigned char*)eaccelerator_logo, sizeof(eaccelerator_logo)); + #endif return SUCCESS; >
. make and make test both worked fine. Doesn’t mean it’s going to work with PHP5.5 I guess?
/me looks at OpCache instead.