Running macOS Sierra.

How can I complete remove all links to the default installed PHP version? I have installed PHP 7 through homebrew but when I run scripts that call external CLI applications programatically they still seem to end up using PHP 5.6.25 which is the default installed PHP version.

What can I do to break all ties to this PHP version?

My php -v and phpinfo() already show the proper PHP7 version that I installed. Somehow some scripts still try to look for the default version.

I already read you cannot simply delete it.

If you need more info please let me know.


Try this:

sudo mv /usr/bin/php /usr/bin/php5
sudo ln -s `which php` /usr/bin/php

The first command backs up the old PHP binary. It can still be used by invoking php5 in a command line. The second command symlinks the new PHP 7 binary to the location of the old PHP binary. Therefore, scripts that use the old location will start using the new PHP version.

| improve this answer | |

You must log in to answer this question.

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