Answer the question
In order to leave comments, you need to log in
How to run go lang scripts with php exec?
When executed from the console: go run main.go
Outputs:
cannot find package "github.com/PuerkitoBio/goquery" in any of:
/usr/lib/go/src/github.com/PuerkitoBio/goquery (from $GOROOT)
export GOPATH=/usr/lib/go
exec('go run /var/www/mysite.ru/blog/go/main.go 2>&1', $output);
print_r($output);
Answer the question
In order to leave comments, you need to log in
What am I doing wrong?
GOPATH and GOROOT are needed for Go itself to work, and your PHP can't find the Go executable, so either specify the full path to it (like /usr/local/go/bin/go) or add the path to the PATH environment variable to him.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question