I have a Go app that must run from a PHP script with shell_exec()
/exec()
. The problem is when I call the Go script that way, the GOPATH changes or can't be found, and the imports from go get
can't be found too. Everything is fine when I call it manually on terminal.
Trying to solve it, the GOPATH was set to /var/www
on .bashrc and updated with source ~/.bashrc
), but when I use go env
under apache's user (www-data), the folders act like the Apache user can't read the environment variables and read the default values but the root folder from Go's view is /var/www
, not /
.
How can I make apache/PHP run Go properly?