deuill / go-php

PHP bindings for the Go programming language (Golang)
MIT License
925 stars 105 forks source link

Compilation Error #42

Open Varun-Sethu opened 7 years ago

Varun-Sethu commented 7 years ago

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

deuill commented 7 years ago

Hi, which OS and distribution are you trying to run this on?

Varun-Sethu commented 7 years ago

Ubuntu 16.04 LTS

Varun-Sethu commented 7 years ago

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
deuill commented 7 years ago

Try building with the debian tag:

go get -u -v -tags 'php7 debian' github.com/deuill/go-php
Varun-Sethu commented 7 years ago

Ok thanks.

Varun-Sethu commented 7 years ago

I'm still getting the ld returned 1 error.

deuill commented 7 years ago

Is it possible that you haven't installed the right package? You'd need to install libphp-embed.

KMantas commented 7 years ago

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

boredwookie commented 5 years ago

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: