Reputation: 138
I am working on php terminal emulator, and it works, but its not using any .bashrc or .bash_profile files. So aliases to commands dont work. Im on a shared server which has both php5.4 and php 5.2 so when i run a command from the terminal emulator its using the wrong php version but if i actually ssh in and run commands its using the right version. I need to use php 5.4 but im not sure how to make that happen.
ive made sure that im acutally using bash
/bin/sh -> /bin/bash
here is my working (via ssh) .bashrc
alias 'php=/usr/local/php54/bin/php'
export PATH=~/bin/:/usr/local/php54/bin/:$PATH
however when i log in to my terminal emulator, echo $PATH produces
/usr/local/bin:/usr/bin:/bin
Im using system() to emulate, but i have also tried exec() and shell_exec
Upvotes: 0
Views: 2830
Reputation: 486
I dont think the $path variable is important as far as what you are trying to do.
If you have php 5.4 installed in /usr/local/php54/bin/ you should be able to run your CLI like this;
/usr/local/php54/bin/php -f /path/to/php-file-to-run.php
Upvotes: 2
Reputation: 7316
If your problem is just with PHP (and you do not care about actually reading the .bash_profile file), then you can just call the PHP binary using the full path:
$ /path/to/php somefile.php
To determine which is the path of the "php" binary that you're executing when you're using SSH, just run:
$ which php
Will produce as output the full path (presumably "/usr/local/php54/bin/php")
Upvotes: 1