php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch php-cgi-path-detection.patch for CGI/CLI related Bug #61949

Patch version 2012-05-05 07:52 UTC

Return to Bug #61949 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: remi@php.net

--- include.inc.old	2012-05-05 08:41:43.225085081 +0200
+++ include.inc	2012-05-05 08:52:03.575099923 +0200
@@ -3,7 +3,9 @@
 function get_cgi_path() /* {{{ */
 {
 	$php = getenv("TEST_PHP_EXECUTABLE");
-
+	if (!$php && defined('PHP_BINARY')) {
+		$php = PHP_BINARY;
+	}
 	$cli = false;
 	$cgi = false;
 
@@ -21,6 +23,10 @@
 	if ($cli) {
 		/* trying to guess ... */
 		$php_path = $php;
+		if (file_exists($php_path."-cgi") && is_executable($php_path."-cgi")) { 
+			/* gotcha - run for install */
+			return $php_path."-cgi";
+		}
 		for ($i = 0; $i < 2; $i++) {
 			$slash_pos = strrpos($php_path, "/");
 			if ($slash_pos) {
@@ -31,7 +37,7 @@
 		}
 
 		if ($php_path && is_dir($php_path) && file_exists($php_path."/cgi/php-cgi") && is_executable($php_path."/cgi/php-cgi")) { 
-			/* gotcha */
+			/* gotcha - run from build tree*/
 			return $php_path."/cgi/php-cgi";
 		}
 		return false;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC