PHP shell scripts stop working if PHP executable is symlinked

March 9, 2012

I do web development for PHP on a MAC. Recently I installed the Acquia Dev desktop which is quite handy. It installed its own version of PHP to /Applications/acquia-drupal/php/bin/php

I needed to use this PHP from the command line so put a symnlink from /usr/bin/php -> /Applications/acquia-drupal/php/bin/php

Now, I also had phpcs installed, but moving PHP from an executable to a symmlink really upset it and it stopped working. Indeed, no shell script with the following shebang starting line would work anymore.


The solution is to instead use the following line at the top of those shell scripts instead:

#!/usr/bin/env php

So to make phpcs work again I had to edit /usr/bin/phpcs



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: