Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason using php at the command line references /usr/local/bin/php instead of /usr/bin/php. How can I make $ php script.php the equivalent of running $ /usr/bin/php script.php?

Current setup:

$ which php

Desired setup:

$ which php
share|improve this question

migrated from Jun 5 '13 at 0:12

This question came from our site for professional and enthusiast programmers.

create a Symbolic link ln -s /usr/local/bin/php /usr/bin/php – Dagon Jun 4 '13 at 22:12
There already is another version of php at /usr/bin/php, so I'd rather not overwrite that with a symbolic link. – Ryan Jun 4 '13 at 22:20
ok, well its just one of many options :-) – Dagon Jun 4 '13 at 22:25
up vote 3 down vote accepted

Either change $PATH to contain /usr/bin first, or use your shell's alias capability to point php to /usr/bin/php.

alias php=/usr/bin/php
share|improve this answer
Yay! Thanks so much. – Ryan Jun 4 '13 at 22:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .