Sudo phpcli upgrading


#1

Hello, I need to be able to use the php-cli with php5. Currently, if I use php-cli as normal it works just fine. However, if I need to use a script that requires heightened permissions via the sudo command then I get an error about upgrading my php-cli to version 5 or greater. I am running a Dreamhost VPS.

Current result from $ php -v
PHP 5.2.10 (cli) (built: Aug 26 2009 20:49:43)
Copyright © 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright © 1998-2009 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright © 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright © 1998-2007, by Zend Technologies

Current result from $ sudo php -v
PHP 4.4.9 (cli) (built: Sep 17 2008 12:02:18)
Copyright © 1997-2008 The PHP Group
Zend Engine v1.3.0, Copyright © 1998-2004 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright © 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright © 1998-2007, by Zend Technologies


#2

try “sudo /usr/local/php5/bin/php”


#3

The cursor just sits there and blinks.[hr]
sorry, I appended the -v onto your command and got
PHP 5.2.10 (cli) (built: Aug 26 2009 20:49:43)
Copyright © 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright © 1998-2009 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright © 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright © 1998-2007, by Zend Technologies


#4

so anybody know how to make php5 my default sudo php-cli?


#5

I think you will find what you are looking for on our wiki at http://wiki.dreamhost.com/Php#Make_PHP5_the_Default_in_the_Shell


#6

nope, didn’t work.

after do that it still gives me PHP 4.4.9 when I run

sudo php -v

Why does sudo php and php run two different versions?