山狮更改php位置 [英] Mountain Lion change php location

查看:57
本文介绍了山狮更改php位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

It installs 5.4 to /usr/local/php5

如果我运行 which php 我得到/usr/bin/php

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

运行 php -v 返回 5.3.13

And running php -v returns 5.3.13

如何告诉Mountain Lion使用/usr/local/php5中的php

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

我是否还需要更改 Apache htttpd.conf 才能使用新版本的 php?

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

谢谢

推荐答案

这很难,你只需链接到新的 php 文件:

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

根据真正的php5二进制路径更改php5 bin路径,因为我不知道正确的二进制文件在哪里.

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

但我宁愿尝试在命令行上只使用 php5 因为这可能使用的是 PHP5.4 版本,因为 /usr/local 通常在$PATH 也是.

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.

您可以通过命令行中的 echo $PATH 查看哪些路径被检查.你可以通过使用 export PATH=/usr/local/php5:$PATH 或类似的东西来添加一些东西.您也可以将该行添加到 ~/.bash_profile 文件中,以便将其存储以备后用.

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.

这篇关于山狮更改php位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆