我正在尝试让 apache/php 识别我的 git 的路径。我一直在研究和查看网络的各个角落,但找不到如何执行此操作。基本上,无论我尝试什么,当我运行 echo phpinfo();
Apache Environment
路径都不会从 /usr/bin:/bin:/usr/sbin:/sbin
.当我在 PHP 中运行 system('echo $PATH');
时,它读取相同的内容。
系统信息:
- Mac OSX(狮子版)
- Apache 2(以 _www 运行)
- PHP 5.3.6
这是我到目前为止尝试编辑的内容:
- /etc/配置文件
- ~/.bash_profile
- ~/.profile
- /etc/路径
- /etc/path.d/{NEW_FILE}
到目前为止,我没有尝试更改 $PATH
变量。有什么想法吗?
解决方案
所以这是最终的解决方案。我编辑了
/System/Library/LaunchDaemons/org.apache.httpd.plist
并添加
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin</string>
</dict>
最佳答案
您可以在/System/Library/LaunchDaemons/org.apache.httpd.plist
中设置PATH环境变量。
docs 中的更多信息.
关于php - mac 上 apache2 的 $PATH 环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6833939/