File tree Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -23,24 +23,21 @@ function get_cgi_path() /* {{{ */
23
23
$ php_path = $ php ;
24
24
if (defined ("PHP_WINDOWS_VERSION_MAJOR " )) {
25
25
/* On Windows it should be in the same dir as php.exe in most of the cases. */
26
- $ php_path = dirname ($ php );
27
-
28
- if (is_dir ($ php_path ) && file_exists ("$ php_path/php-cgi.exe " ) && is_executable ("$ php_path/php-cgi.exe " )) {
29
- return "$ php_path/php-cgi.exe " ;
26
+ $ cgi_path = dirname ($ php ) . "/php-cgi.exe " ;
27
+ if (is_executable ($ cgi_path )) {
28
+ return $ cgi_path ;
30
29
}
31
30
} else {
32
- for ($ i = 0 ; $ i < 2 ; $ i ++) {
33
- $ slash_pos = strrpos ($ php_path , "/ " );
34
- if ($ slash_pos ) {
35
- $ php_path = substr ($ php_path , 0 , $ slash_pos );
36
- } else {
37
- return FALSE ;
38
- }
31
+ /* Try in the same path as php, for the case where php is installed. */
32
+ $ cgi_path = dirname ($ php ) . "/php-cgi " ;
33
+ if (is_executable ($ cgi_path )) {
34
+ return $ cgi_path ;
39
35
}
40
36
41
- if ($ php_path && is_dir ($ php_path ) && file_exists ($ php_path ."/cgi/php-cgi " ) && is_executable ($ php_path ."/cgi/php-cgi " )) {
42
- /* gotcha */
43
- return $ php_path ."/cgi/php-cgi " ;
37
+ /* Try sapi/cgi/php-cgi, for the case where php is not installed. */
38
+ $ cgi_path = dirname ($ php , 3 ) . "/sapi/cgi/php-cgi " ;
39
+ if (is_executable ($ cgi_path )) {
40
+ return $ cgi_path ;
44
41
}
45
42
}
46
43
return false ;
You can’t perform that action at this time.
0 commit comments