山狮改变PHP的位置

山狮改变PHP的位置

问题描述:

After upgrading to Mountain Lion I used this one line bash script to install php 5.4 http://php-osx.liip.ch/

It installs 5.4 to /usr/local/php5

If i run which php I get /usr/bin/php

And running php -v returns 5.3.13

How do tell Mountain Lion to use the php in /usr/local/php5

Will I also have to change Apache htttpd.conf to use the new version of php?

Thanks

升级到Mountain Lion后我使用这一行bash脚本安装php 5.4 http://php-osx.liip.ch/ p>

它将5.4安装到/ usr / local / php5 p>

如果我运行哪个php我得/ usr / bin / php p>

运行php -v返回5.3.13 p >

如何告诉Mountain Lion在/ usr / local / php5中使用php p>

我是否还必须更改Apache htttpd.conf以使用新版本 php? p>

谢谢 p> div>

This is the hard way, you just link to the new php file:

$ sudo mv /usr/bin/php /usr/bin/php53 && sudo ln -s /usr/local/php5/bin/php /usr/bin/php

Change the php5 bin path according to the real php5 binary path since I have no idea where the correct binary is.

But I'd rather try to use just php5 on the command line since this is probably using the PHP5.4 version because /usr/local is usually in the $PATH as well.

You see which paths are checked by just echo $PATH on your command line. You may just add something to that by using export PATH=/usr/local/php5:$PATH or similar. You can add that line to the ~/.bash_profile file as well to store that for any later use.