Ok so here is my problem. I am trying to write a php script that will run the following type of command.
exec("$(which php) -f /path/to/script.php >> /path/to/log.log 2>&1 &");
The problem is, I am running OSX 10.5 leopard and using the Entropy PHP package. This creates php under /usr/local/php5/bin. The normal php that is installed with OSX in under /usr/bin. So when PHP executes this command it is using the wrong PHP executable. Now I know how to change the $PATH in my .bash_profile by adding it to the begining of the $PATH so that the system takes the PHP I want other then the default PHP. The problem is, when running the php from a script it doesn't do it under my user. So then it doesn't have the updated $PATH settings.
I have also looked into setting it in /etc/paths and etc/paths.d/ but these both append the path to the end, I need it to append to the beginning so that my script will use the right PHP executable.
I know I probably could run another exec command and set the path but this is only a local environment issue and when the code goes to production I won't need this set.