go-php icon indicating copy to clipboard operation
go-php copied to clipboard

Compilation Error

Open Varun-Sethu opened this issue 8 years ago • 9 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 <main/php.h>
                       ^
compilation terminated.

Could this be because I set up the project incorrectly or another reason

Varun-Sethu avatar Aug 27 '17 10:08 Varun-Sethu

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

deuill avatar Aug 27 '17 12:08 deuill

Ubuntu 16.04 LTS

Varun-Sethu avatar Aug 27 '17 12:08 Varun-Sethu

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

Varun-Sethu avatar Aug 27 '17 12:08 Varun-Sethu

Try building with the debian tag:

go get -u -v -tags 'php7 debian' github.com/deuill/go-php

deuill avatar Aug 28 '17 18:08 deuill

Ok thanks.

Varun-Sethu avatar Aug 28 '17 22:08 Varun-Sethu

I'm still getting the ld returned 1 error.

Varun-Sethu avatar Aug 29 '17 12:08 Varun-Sethu

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

deuill avatar Sep 01 '17 22:09 deuill

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

KMantas avatar Sep 08 '17 07:09 KMantas

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

boredwookie avatar Oct 30 '18 12:10 boredwookie