Always use PHP54 (in CLI)

Hello there,

I need to always use PHP54 on my Dreamhost account. Support reference me to to fix this issue. So I edited “~/.bash_profile” and “~/.bashrc” to have export PATH=/usr/local/php54/bin:$PATH I thought that this would make PHP54 always be the default php. However, when I run “shell_exec( ‘php -v’ )” inside a file that was included. which was “exec( php file)” from a index.php webhook I am told it is using 5.2.17. (and yes, this crazy scheme makes since if I explained it, it’s my deploy and update scripts)

Any advice?

By default, your bash profile files (.bash_profile and .bashrc) are only loaded by interactive shells (i.e, when you’re logging in using ssh) — they are not loaded by the interpreter used for “shell_exec()”. You’ll need to either specify the path to PHP explicitly (i.e, “shell_exec(’/usr/local/php54/bin/php …”), or force your profile files to be loaded for the subshell as well.

Probably the easiest way to do this will be to set the BASH_ENV environment variable to the path to one of your profile files, e.g[/php]:

setenv(“BASH_ENV”, “/home/username/.bash_profile”);

Thanks, however setenv doesn’t exist and I couldn’t get it to work with putenv(“BASH_ENV=/home/username/.bash_profile”);