Reputation: 442
I don't understand why, on my server
php --version
gives me :
PHP 5.6.17
when
sh -c 'php --version'
gives me :
PHP 4.4.9
I just want to execute a command in php 5.6 and not in php 4.4 with "sh -c" command.
In other words, why my php alias does not work with "sh -c" ?
And how to make it work with "sh -c" ?
My .bash_profile :
# .bash_profile
# Get the aliases and functions
if [ -r ${HOME}/.bashrc ] ; then
source ${HOME}/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME=""
export USERNAME BASH_ENV PATH
My .bashrc :
# .bashrc
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
alias php='/usr/local/php5.6/bin/php'
Upvotes: 2
Views: 573
Reputation: 531918
Compare the output of bash --version
and sh --version
.
Your sh
is not actually bash
, so .bashrc
isn't sourced when it starts, so the alias php
is not defined in the new shell.
Upvotes: 1