0

I'm attempting to follow this tutorial: http://drupal.org/node/1464236 on installing ffmpeg on MAMP (for use with Drupal, which is incidental)

I'm stuck here:

You should also execute in your Terminal

which php pecl phpize

which should point to your MAMP installation:

/Applications/MAMP/bin/php/php5.x.x/bin

...but when I do it, which php pecl phpize says it's pointing to /usr/bin/php (and pecl and phpize respectively). If I do ln /usr/bin/php /Applications/MAMP/bin/php/php5.3.6/bin/php it says 'file already exists'. How do I point to the right file?

beth
  • 1,916
  • 4
  • 23
  • 39

2 Answers2

1

Your $PATH is wrong, which means that something went wrong in the first step of that tutorial:

First of all point your php and phpize to your MAMP environment
Add/change following line in ~/.profile or ~/.bashrc (for bash):

    export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.2.17/bin:/usr/local/bin:$PATH:/opt/local/bin

and after that please re-login (or just execute e.g. /bin/bash).

Did you remember to re-login?


Let me also add, doing something like your attempted fix with ln is generally not a good idea. /usr/bin generally contains system-installed software and may depend on that software being the correct version in the correct location. If you want to use a different version of PHP for something, the standard practice is to install it somewhere else, like /usr/local/bin, and then have that directory listed before /usr/bin in your $PATH. That way you'll use your version, while the system will still have its version to use.

blahdiblah
  • 33,069
  • 21
  • 98
  • 152
  • I'm not totally clear on what re-login means. I restarted terminal as well as MAMP. Was I supposed to restart something else? – beth Aug 03 '12 at 21:56
  • @beth That should be enough. If you `echo $PATH` are the MAMP directories at the beginning of the list? – blahdiblah Aug 03 '12 at 21:59
  • Ach! No they're at the end. So I should move them to the front of the list? – beth Aug 03 '12 at 22:00
  • @beth Yes you should. Ordering is the name of the game when it comes to the `$PATH`. In a nutshell, when you type `php` your shell is going to look at each directory in `$PATH` until it finds something executable called `php`. If `/usr/bin` comes before the MAMP directory, it'll use the copy of php there. – blahdiblah Aug 03 '12 at 22:01
-2

Try

ls -l /usr/bin

If it shows something like /usr/bin/php -> /Applications/MAMP/bin/php/php5.x.x/bin in the last column you're all good. Otherwise, you might have to uninstall the non-MAMP php installation.

EDIT: You can also put the MAMP php path before /usr/bin in your $PATH. The first step in the linked tutorial tells you how to do that.

Anand
  • 7,654
  • 9
  • 46
  • 60
  • Removing system-installed software from `/usr/bin` is generally a bad idea as other parts of the system may well depend on having exactly that version of the software in exactly that location. – blahdiblah Aug 03 '12 at 21:48