ID:               45125
 Updated by:       [EMAIL PROTECTED]
 Reported By:      florent at guiliani dot fr
-Status:           Open
+Status:           Bogus
 Bug Type:         CGI related
 Operating System: GNU/Linux Ubuntu
 PHP Version:      5.2.6
-Assigned To:      
+Assigned To:      dmitry
 New Comment:

At first note that -C means DO NOT chdir to the script's directory (it
is not clear from the report).

"-C" option has effect only for command-line usage by design.
In case PHP supports it in FastCGI mode (as requested), we will allow
incompatible behavior between FastCGI and other SAPIs, whish always do
chdir to script's directory. So scripts, which written in assumption
that this option work, won't work with other SAPIs. Also with this
option enabled, any chdir() in PHP script may break all the following
requests, because of invalid CWD expectation.

In your example (/usr/bin/php5-cgi -C -b 9876) "-C" just doesn't have
effect.



Previous Comments:
------------------------------------------------------------------------

[2008-05-29 10:14:04] florent at guiliani dot fr

Description:
------------
The option -C "chdir to the script's directory" doesn't work when using
PHP as FASTCGI server.

Due to this issue a first request will work and a second identical
request will return "no input file specified"


Reproduce code:
---------------
$ strace -o strace.log /usr/bin/php5-cgi -C -b 9876
(run 2 identical requests)
$ grep "chdir\|index.php" strace.log
lstat64("/home/flgu/tmp/websvn/index.php", {st_mode=S_IFREG|0644,
st_size=1656, ...}) = 0
open("/home/flgu/tmp/websvn/index.php", O_RDONLY|O_LARGEFILE) = 7
chdir("/home/flgu/tmp/websvn")          = 0
open("/home/flgu/tmp/websvn/websvn/index.php", O_RDONLY|O_LARGEFILE) =
-1 ENOENT (No such file or directory)
$

Note the double "websvn/websvn" in the second open.

You can use this cgi to test it (adapt it with your own path):
#!/bin/bash

export SCRIPT_FILENAME=${REQUEST_URI/\/~flgu\/fast.cgi\//}

/home/flgu/tmp/fcgi-2.4.0/cgi-fcgi/cgi-fcgi -bind -connect
localhost:9876


Expected result:
----------------
No chdir called and all request work

Actual result:
--------------
chdir called and only first request work


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45125&edit=1

Reply via email to