Compilation Error
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 <main/php.h>
^
compilation terminated.
Could this be because I set up the project incorrectly or another reason
Hi, which OS and distribution are you trying to run this on?
Ubuntu 16.04 LTS
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
Ok thanks.
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
In case anyone else runs into this same issue: I am running Ubuntu 16.04 and encountered this same issue when trying to 'go get' the library (go get -u -v -tags 'php7 debian' github.com/deuill/go-php) and had to install these 2 packages for it to 'go get' successfully:
- libphp7.0-embed
- php7.0-dev