2016-02-17 15:03
浏览 135


When I run a script on Windows using PHP 5.6 (coming from WampServer 2.4) I get this confusing result:

$binary = PHP_BINARY;  // $binary: "C:\wamp\bin\php\php5.6.15\php.exe"
$bindir = PHP_BINDIR;  // $bindir: "C:\php"

PHP_BINARY is correct but PHP_BINDIR is completely wrong. Is the latter variable deprecated or something? Any other ideas why it would output some random path that doesn't even exist on my disk?

图片转代码服务由CSDN问答提供 功能建议

当我使用PHP 5.6在Windows上运行脚本时(来自 WampServer 2.4 )我得到了这个令人困惑的结果:

  $ binary = PHP_BINARY;  // $ binary:“C:\ wamp \ bin \ php \ php5.6.15 \ php.exe”
 $ bindir = PHP_BINDIR;  // $ bindir:“C:\ php”

PHP_BINARY 是正确的但是 PHP_BINDIR 是完全错误的 。 后一个变量是否已被弃用? 任何其他的想法,为什么它会输出一些甚至不存在于我的磁盘上的随机路径?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

  • dounao2829 2016-02-17 15:13

    PHP_BINARY is a value set on runtime (when the script is executed)

    PHP_BINDIR is a value set on compile time, not on runtime.

    The path is set to the prefix used in configure (Linux equivalent: ./configure --prefix <path>). The default path on windows is C:\php. You cannot change it without recompiling PHP.

    To get the path, you should trail down PHP_BINARY.

    解决 无用
    打赏 举报

相关推荐 更多相似问题