'whereis X' will tell you if the program X is in one of the typical locations for executables.
If you want to know WHICH version of the executable X will be run if you type the command without specifyin a path then you need to use 'which X'.
Sometimes you'll find /usr/bin/php is a symbolic link to /usr/local/bin/php. To find out, examine the output of:
ls -al /usr/bin/php
If it isn't you could try:
diff /usr/local/bin/php /usr/bin/php
to see if they're the same. If they're not then try:
/usr/bin/php -version
and
/usr/local/bin/php -version
to see which version is which.