I'm looking to get apache/php to identify the road to my git. I've been researching and searching in most corners from the web and can't find how to get this done. Essentially, regardless of what I attempt, after i run echo phpinfo(); the Apache Environment path doesn't vary from /usr/bin:/bin:/usr/sbin:/sbin. So when I run system('echo $PATH'); in PHP, it reads exactly the same.

System Information:

  • Macosx (Lion)
  • Apache 2 (running as _www)
  • PHP 5.3.6

Here's what I've attempted editing to date:

  • /etc/profile
  • ~/.party_profile
  • ~/.profile
  • /etc/path
  • /etc/path.d/

Nothing I've attempted to date has transformed the $PATH variable. Any ideas?


So this is actually the final solution. I edited the


and added


What about setting the road atmosphere variable in /System/Library/LaunchDaemons/org.apache.httpd.plist?

More here: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html

Have you update the road atmosphere variable of user '_www'? Apache will read atmosphere variables in the user runs itself. Or, it appears as if you did not restart apache after upgrading PATH atmosphere variable.

And when you need to modify atmosphere variable in PHP, getenv() and putenv() could be a better option.

for ubuntu server, in /etc/apache2/envvars, for centos server, in /etc/sysconfig/httpd, to include:

export PATH=<your php cli path>

and restart apache