FAQ
Can somebody look into https://bugs.php.net/bug.php?id=54514 please?
This causes issues for CLI tools implemented in PHP that are invoked
through Apache Ant, for instance, and need to know the PHP interpreter
that is running them.

See https://github.com/sebastianbergmann/phpunit/issues/432 for an
example of how this affects PHPUnit.

--
Sebastian Bergmann Co-Founder and Principal Consultant
http://sebastian-bergmann.de/ http://thePHP.cc/

Search Discussions

  • Ferenc Kovacs at Dec 7, 2011 at 8:03 am

    On Wed, Dec 7, 2011 at 8:22 AM, Sebastian Bergmann wrote:

    Can somebody look into https://bugs.php.net/bug.php?**id=54514<https://bugs.php.net/bug.php?id=54514>please?
    This causes issues for CLI tools implemented in PHP that are invoked
    through Apache Ant, for instance, and need to know the PHP interpreter
    that is running them.

    See https://github.com/**sebastianbergmann/phpunit/**issues/432<https://github.com/sebastianbergmann/phpunit/issues/432>for an
    example of how this affects PHPUnit.

    --
    Sebastian Bergmann Co-Founder and Principal Consultant
    http://sebastian-bergmann.de/ http://thePHP.cc/

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php
    +1, I also seen workarounds of this missing functionality in the symfony2:

    https://github.com/symfony/Process/blob/master/PhpExecutableFinder.php
    https://github.com/symfony/symfony/blob/master/tests/Symfony/Tests/Component/Process/PhpExecutableFinderTest.php

    PHP_BINDIR is available, and from a quick test, $_SERVER['_'] has the path
    for the php binary also (only tested it on linux, cli).

    --
    Ferenc Kovács
    @Tyr43l - http://tyrael.hu
  • Laruence at Dec 7, 2011 at 8:16 am
    HI,
    I am looking at it :)

    how about add a PHP_BINARY into $_SERVER, but not register as a constant?

    thanks,
    On Wed, Dec 7, 2011 at 3:22 PM, Sebastian Bergmann wrote:
    Can somebody look into https://bugs.php.net/bug.php?id=54514 please?
    This causes issues for CLI tools implemented in PHP that are invoked
    through Apache Ant, for instance, and need to know the PHP interpreter
    that is running them.

    See https://github.com/sebastianbergmann/phpunit/issues/432 for an
    example of how this affects PHPUnit.

    --
    Sebastian Bergmann                    Co-Founder and Principal Consultant
    http://sebastian-bergmann.de/                           http://thePHP.cc/

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php


    --
    Laruence  Xinchen Hui
    http://www.laruence.com/
  • Pierre Joye at Dec 7, 2011 at 8:41 am
    hi Laruence,
    On Wed, Dec 7, 2011 at 9:16 AM, Laruence wrote:
    HI,
    I am looking at it :)

    how about add a PHP_BINARY into $_SERVER,  but not register as a constant?
    and why not?

    Cheers,
  • Laruence at Dec 7, 2011 at 8:44 am
    HI:

    1. the PHP_BINARY is only make sence in cli sapi
    2. if the use script, by chance, has codes: define("PHP_BINARY",
    ***) will trigger error


    thanks
    On Wed, Dec 7, 2011 at 4:41 PM, Pierre Joye wrote:
    hi Laruence,
    On Wed, Dec 7, 2011 at 9:16 AM, Laruence wrote:
    HI,
    I am looking at it :)

    how about add a PHP_BINARY into $_SERVER,  but not register as a constant?
    and why not?

    Cheers,
    --
    Pierre

    @pierrejoye | http://blog.thepimp.net | http://www.libgd.org


    --
    Laruence  Xinchen Hui
    http://www.laruence.com/
  • Hannes Magnusson at Dec 7, 2011 at 8:49 am

    On Wed, Dec 7, 2011 at 09:44, Laruence wrote:
    HI:

    1.  the PHP_BINARY is only make sence in cli sapi
    2.  if the use script, by chance,  has codes:  define("PHP_BINARY",
    ***) will trigger error
    Constants starting with PHP_ are reserved by PHP.
    This has come up several times before and we agreed a PHP_BINARY
    constant made the most senes.

    "The problem" with this feature was when we backtrack binary to load
    the php.ini file, it was to early in the startup to be able to
    register a constant, variable or whatever..

    -Hannes
  • Pierre Joye at Dec 7, 2011 at 8:49 am

    On Wed, Dec 7, 2011 at 9:44 AM, Laruence wrote:
    HI:

    1.  the PHP_BINARY is only make sence in cli sapi
    It can be the module as well.

    However phpUnit has a design mistake here by not allowing to set the
    php exec binary path to run the tests. But that's another topic :)

    Cheers,
  • Patrick ALLAERT at Dec 7, 2011 at 8:56 am

    2011/12/7 Sebastian Bergmann <sebastian@php.net>:
    Can somebody look into https://bugs.php.net/bug.php?id=54514 please?
    This causes issues for CLI tools implemented in PHP that are invoked
    through Apache Ant, for instance, and need to know the PHP interpreter
    that is running them.

    See https://github.com/sebastianbergmann/phpunit/issues/432 for an
    example of how this affects PHPUnit.

    --
    Sebastian Bergmann                    Co-Founder and Principal Consultant
    http://sebastian-bergmann.de/                           http://thePHP.cc/

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php
    PHP_BINDIR . "/php" ?

    Patrick
  • Laruence at Dec 7, 2011 at 10:39 am
    Hi:
    what if I rename the php to something else :)

    thanks
    On Wed, Dec 7, 2011 at 4:56 PM, Patrick ALLAERT wrote:
    2011/12/7 Sebastian Bergmann <sebastian@php.net>:
    Can somebody look into https://bugs.php.net/bug.php?id=54514 please?
    This causes issues for CLI tools implemented in PHP that are invoked
    through Apache Ant, for instance, and need to know the PHP interpreter
    that is running them.

    See https://github.com/sebastianbergmann/phpunit/issues/432 for an
    example of how this affects PHPUnit.

    --
    Sebastian Bergmann                    Co-Founder and Principal Consultant
    http://sebastian-bergmann.de/                           http://thePHP.cc/

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php
    PHP_BINDIR . "/php" ?

    Patrick

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php


    --
    Laruence  Xinchen Hui
    http://www.laruence.com/
  • Derick Rethans at Dec 7, 2011 at 5:45 pm

    On Wed, 7 Dec 2011, Sebastian Bergmann wrote:

    Can somebody look into https://bugs.php.net/bug.php?id=54514 please?
    This causes issues for CLI tools implemented in PHP that are invoked
    through Apache Ant, for instance, and need to know the PHP interpreter
    that is running them.

    See https://github.com/sebastianbergmann/phpunit/issues/432 for an
    example of how this affects PHPUnit.
    I've code to do this on Windows:

    #if WIN32
    PHP_FUNCTION(get_php_process)
    {
    char filename[1024];
    GetModuleFileName(NULL, filename, 1024);
    RETURN_STRING(filename, 1)
    }
    #endif

    On linux, we currently do:

    $pid = getmypid();
    $process = "/proc/{$pid}/exe"

    cheers,
    Derick

    --
    http://derickrethans.nl | http://xdebug.org
    Like Xdebug? Consider a donation: http://xdebug.org/donate.php
    twitter: @derickr and @xdebug
  • Pierre Joye at Dec 7, 2011 at 9:49 pm
    hi Derick,

    yes, that's what is done in the ini detection implementation, which is
    now used in main/.

    The only remaining related bug I like to fix is ot PHP_BINDIR, which
    is now set at compile time. We could do the same thing than now
    PG(PHP_BINDIR).
    On Wed, Dec 7, 2011 at 6:45 PM, Derick Rethans wrote:
    On Wed, 7 Dec 2011, Sebastian Bergmann wrote:

    Can somebody look into https://bugs.php.net/bug.php?id=54514 please?
    This causes issues for CLI tools implemented in PHP that are invoked
    through Apache Ant, for instance, and need to know the PHP interpreter
    that is running them.

    See https://github.com/sebastianbergmann/phpunit/issues/432 for an
    example of how this affects PHPUnit.
    I've code to do this on Windows:

    #if WIN32
    PHP_FUNCTION(get_php_process)
    {
    char filename[1024];
    GetModuleFileName(NULL, filename, 1024);
    RETURN_STRING(filename, 1)
    }
    #endif

    On linux, we currently do:

    $pid = getmypid();
    $process = "/proc/{$pid}/exe"

    cheers,
    Derick

    --
    http://derickrethans.nl | http://xdebug.org
    Like Xdebug? Consider a donation: http://xdebug.org/donate.php
    twitter: @derickr and @xdebug

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php


    --
    Pierre

    @pierrejoye | http://blog.thepimp.net | http://www.libgd.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedDec 7, '11 at 7:22a
activeDec 7, '11 at 9:49p
posts11
users7
websitephp.net

People

Translate

site design / logo © 2022 Grokbase