php version in terminal

You can ask general questions about MAMP here.

Moderator: severin

php version in terminal

Postby landpro28 » Sun Aug 13, 2006 9:55 am

Hello!

I have installed MAMP and everything is good. It works!

But I have problem when I'm trying to run scripts from terminal. I use php5 and I need to run scripts from shell with php5 parser. In Mamp panel I choosed php5 and phpinfo() from scripts shows php5 info page. But when I call php -v from terminal I get php 4.1.1....

How to fix it?
landpro28
 
Posts: 1
Joined: Sun Aug 13, 2006 9:47 am
Location: Moscow, Russia

Postby msodrew » Mon Aug 21, 2006 1:56 am

I'm pretty sure mamp doesnt install the php CLI (command line interface)... and it already obfuscates common paths.

e.g. it would be a real pain to change all the #!/bin/php 's into #!/path/where/mamp/dumps/php and vice versa at the top of your scripts.

php -v is saying 4.x.x because thats the php that is automatically installed with Mac OS X.

if you wanna be thug and use the PHP CLI, you might as well compile and setup from source. There are many instructions online how to do this.
msodrew
 
Posts: 2
Joined: Fri Mar 03, 2006 1:34 am
Location: Berkeley, CA

Postby Vylen » Tue Aug 22, 2006 4:18 am

you could do that.............

or do what i did

just make a symbollic link in /usr/bin/ that points to the php5 version supplied by mamp
i.e.
[Back-up (if you want) the original php version]:
$ cp /usr/bin/php /usr/bin/php4
[Make the symbollic link]:
$ ln -s /Applications/MAMP/bin/php5/bin/php /usr/bin/php

and then you're done
Vylen
 
Posts: 3
Joined: Tue Aug 22, 2006 4:13 am

Postby jeffbax » Mon Oct 23, 2006 8:42 pm

I tried to do that, but it says

ln: /usr/bin/php: File exists

Any advice on how to overwrite it?
jeffbax
 
Posts: 7
Joined: Fri Feb 25, 2005 11:39 pm

Postby romedawg » Tue Oct 30, 2007 12:16 am

With the method posted above

backup default php
create symbolic link: ln -s

would this link be only available for this terminal session? Would i have to enter these commands each time I open up terminal? And how would I go about resetting the default installed php?

thanks
romedawg
 
Posts: 5
Joined: Sat Oct 06, 2007 10:47 pm


Return to General questions

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 3 guests