dsaxw4201 2018-12-11 18:35
浏览 33

使用PHP的shell_exec调用Go正在改变GOP​​ATH

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?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 软件工程用例图的建立(相关搜索:软件工程用例图|画图)
    • ¥15 如何在arcgis中导出拓扑关系表
    • ¥15 处理数据集文本挖掘代码
    • ¥15 matlab2017
    • ¥15 在vxWorks下TCP/IP编程,总是connect()报错,连接服务器失败: errno = 0x41
    • ¥15 AnolisOs7.9如何安装 Qt_5.14.2的运行库
    • ¥20 求:怎么实现qt与pcie通信
    • ¥50 前后端数据顺序不一致问题,如何解决?(相关搜索:数据结构)
    • ¥15 基于蒙特卡罗法的中介效应点估计代码
    • ¥15 罗技G293和UE5.3