mac 上 apache2 的 $PATH 环境变量 [英] $PATH environment variable for apache2 on mac
问题描述
我正在尝试让 apache/php 识别到我的 git 的路径.我一直在研究和寻找网络的各个角落,但找不到如何做到这一点.基本上,无论我尝试什么,当我运行 echo phpinfo();
时,Apache Environment
路径都不会从 /usr/bin:/bin:/改变usr/sbin:/sbin
.当我在 PHP 中运行 system('echo $PATH');
时,它读取相同的内容.
I am trying to get apache/php to recognize the path to my git. I have been researching and looking in all corners of the web and cannot find how to do this. Basically, no matter what I try, when I run echo phpinfo();
the Apache Environment
path does not change from /usr/bin:/bin:/usr/sbin:/sbin
. And when I run system('echo $PATH');
in PHP, it reads the same.
系统信息:
- Mac OSX (Lion)
- Apache 2(作为 _www 运行)
- PHP 5.3.6
这是我迄今为止尝试编辑的内容:
Here is what I have tried editing so far:
- /etc/profile
- ~/.bash_profile
- ~/.profile
- /etc/path
- /etc/path.d/{NEW_FILE}
到目前为止,我没有尝试过任何改变 $PATH
变量的方法.有什么想法吗?
Nothing I have tried so far has changed the $PATH
variable. Any ideas?
解决方案
所以这是最终的解决方案.我编辑了
So here is the final solution. I edited the
/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环境变量.
You can set the PATH environment variable in /System/Library/LaunchDaemons/org.apache.httpd.plist
.
这篇关于mac 上 apache2 的 $PATH 环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!