Reputation: 53331
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?
Upvotes: 5
Views: 1662
Reputation: 94672
The issue is with PHP_BINDIR
which according to the php-internals/11c783wgty/bug-54514
is set at compile time. This suggests this may change at some later date.
Anything set at compile time is going to be irrelevant to, at least us windows users, as we normally rely on someone else to do the compilation as Windows does not come with a free compiler. As far as I can tell this would apply to php compiled on a unix machine as well as a windows machine as there is no reason to be positive PHP is running from where it was compile into.
So dont use PHP_BINDIR
to find where the current executable is running from.
Upvotes: 0
Reputation: 32350
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
.
Upvotes: 6