I have a question about setting "$PATH" variables for PHP scripts in AMPPS (On OSX 10.10 Yosemite).
The PHP in AMPPS seems to run as my user "danny", however the $PATH it sees is different. Here's what I see from my terminal: Dannys-MacBook-Air:AMPPS danny$ echo $PATH; /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
And here is what I get within a PHP script by printing out $_ENV: ["PATH"]=> string(29) "/usr/bin:/bin:/usr/sbin:/sbin" ["USER"]=> string(5) "danny"
I tried doing "putenv()", tried doing "shell_exec" with a different $PATH, I tried doing SetEnv in .htaccess and in the Apache config file. I tried editing the systemwide /etc/.bashrc , and my users ~/.bash_profile. Neither helped so far.
All I need is to have /usr/local/bin as part of my $PATH.
putenv()etc. won't help you, you have to set thePATHbefore Apache starts. I ended up writing a small start script to modify the environment and then fire up my/opt/local/apache2/bin/apachectl(installed using MacPorts).export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin "in both of the files/Applications/AMPPS/apache/bin/envvarsand/Applications/AMPPS/apache/bin/envvars-stdand I'm getting the same result again["PATH"]=> string(29) "/usr/bin:/bin:/usr/sbin:/sbin"