douyoupingji7238 2015-03-27 10:30
浏览 98
已采纳

如何告诉/ bin / bash正确的php版本? (小牛)

I am using SublimeText to run PHPUnit tests continuosly. Works great, but now I stumbled upon something strange. I updated to the latest PHP version via Homebrew and if I open a Terminal session and type php -v, this is what I get:

PHP 5.6.7 (cli) (built: Mar 22 2015 19:03:55) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

The shell instance that is used by SublimeText seems not to use this version of PHP. If I do the same there (via writing echo shell_exec('php -v');die(); into a PHPUnit test), I get this:

PHP 5.4.24 (cli) (built: Jan 19 2014 21:32:15) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

I tested around a bit and found out, that automator puts out the same if I run a shell script in \bin\bash shell via automator's 'run shell script' action.

How to tell /bin/bash to use the newly installed PHP version?

  • 写回答

1条回答 默认 最新

  • dongwu9647 2015-03-27 10:35
    关注

    When you issue the command $ php, the PATH is searched for the binary. You can find out which one will be executed with the command $ which php.

    If you want to explicitly run one or another php binary when multiple ones are installed, use full absolute path to the binary, e.g. $ /opt/php5.6/bin/php.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置