[英]Mountain Lion change php location
After upgrading to Mountain Lion I used this one line bash script to install php 5.4 http://php-osx.liip.ch/ 升级到Mountain Lion之后,我使用了这一行bash脚本来安装php 5.4 http://php-osx.liip.ch/
It installs 5.4 to /usr/local/php5 它将5.4安装到/ usr / local / php5
If i run which php I get /usr/bin/php 如果我运行哪个php我会得到/ usr / bin / php
And running php -v returns 5.3.13 并运行php -v返回5.3.13
How do tell Mountain Lion to use the php in /usr/local/php5 如何告诉山狮在/ usr / local / php5中使用php
Will I also have to change Apache htttpd.conf to use the new version of php? 我是否还必须更改Apache htttpd.conf以使用新版本的php?
Thanks 谢谢
This is the hard way, you just link to the new php file: 这是困难的方法,您只需链接到新的php文件:
$ 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. 根据实际的php5二进制路径更改php5 bin路径,因为我不知道正确的二进制文件在哪里。
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. 但我宁愿尝试在命令行上仅使用
php5
,因为这可能使用的是PHP5.4版本,因为/usr/local
通常也位于$PATH
中。
You see which paths are checked by just echo $PATH
on your command line. 您可以通过在命令行中仅
echo $PATH
来查看检查了哪些路径。 You may just add something to that by using export PATH=/usr/local/php5:$PATH
or similar. 您可以使用
export PATH=/usr/local/php5:$PATH
或类似的方法在其中添加一些内容。 You can add that line to the ~/.bash_profile
file as well to store that for any later use. 您也可以将该行添加到
~/.bash_profile
文件中,以存储该行以备后用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.