|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55672 Autoguessing TEST_PHP_EXECUTABLE if none is provided in run-tests.php
Submitted: 2011-09-12 12:29 UTC Modified: 2020-08-10 09:27 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Assigned: nikic (profile)
Status: Closed Package: Testing related
PHP Version: trunk-SVN-2011-09-12 (SVN) OS:
Private report: No CVE-ID: None
 [2011-09-12 12:29 UTC]
I've made some improvements to run-tests.php:
they're not provided, i.e. assume they have value 'auto'. You can
still pass your own value as usual.

Autoguessing is done this way:
Looking for ./sapi/cli/php from the current directory, and, if not found
from directory where run-tests.php script is resides (Christofer Jones 
php-cgi is looked for the same way.

2) Added option -n (use no php.ini) to the shebang line
(#!/usr/bin/php -n) so it would run more reliably on some hosts. My
Ubuntu setup did not have E letter in variables_order (i.e.
variables_order=GPCS) so $_ENV array was empty and some tests were
skipped when they could be run.
3) Some better error handling of wrong paths

So now you can run run-tests.php with just
$ ./run-tests.php ext
instead of
$ TEST_PHP_EXECUTABLE=auto php -n run-tests.php ext

You can also run run-tests.php from sub-dir, it will correctly guess
'auto' as well:
$ cd ext/
$ ../run-tests.php zlib


autoguessing-php-executable (last revision 2011-09-12 12:32 UTC by confik at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-12 14:19 UTC]
how about use $0 ?
 [2011-09-15 20:38 UTC]
This patch is not about guessing php executable that runs run-tests.php, but is 
about php binary to be tested, these are often different binaries.
 [2011-09-26 22:14 UTC]
-Package: *Configuration Issues +Package: Testing related
 [2011-09-26 22:50 UTC]
Alex, maybe you should submit the getenv part of the patch separately to as it seems that we have a general agreement 
on fixing that.

 [2020-08-10 09:27 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-08-10 09:27 UTC]
Nowadays run-tests.php defaults to using PHP_BINARY (formerly -P), as usually the same binary is used for running and testing.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri May 07 16:01:28 2021 UTC