FastCGI : SCRIPT_FILENAME vs. PATH_TRANSLATED

bogus

Active Member
#1
Sorry if I post in the wrong forum...

It looks like LSWS does not provide the same environment variables to the FastCGI process when it is considered as a script handler or when it is considered as a context handler.

In particular : SCRIPT_FILENAME seems to be available only to script handlers whereas PATH_TRANSLATED seems to be available only to context handlers... In both case the FastCGI is a RESPONDER.

So I'm a bit confused here, because I'm trying to make php work as a context handler (to have a remote PHP process without duplicating the doc_tree in both places). But PHP seems to rely on SCRIPT_FILENAME only. So it does not work.

Is LSWS behavior the standard, or is PHP wrong ? Or I'm missing something (as usual :cry: )

Thank you.
 

bogus

Active Member
#2
Well, I've found part of the answer myself (PHP side) : configuring PHP with --disable-discard-path let PHP use PATH_TRANSLATED when SCRIPT_FILENAME is not available.
 

mistwang

LiteSpeed Staff
#3
bogus said:
In particular : SCRIPT_FILENAME seems to be available only to script handlers whereas PATH_TRANSLATED seems to be available only to context handlers... In both case the FastCGI is a RESPONDER.

So I'm a bit confused here, because I'm trying to make php work as a context handler (to have a remote PHP process without duplicating the doc_tree in both places). But PHP seems to rely on SCRIPT_FILENAME only. So it does not work.

Is LSWS behavior the standard, or is PHP wrong ? Or I'm missing something (as usual :cry: )
The behavior of LSWS you observed is correct and as designed. We are not sure it is standard or not, I think it make sense this way. As a context handler, web server does not know exactly the URL points to a script file or not, so only PATH_TRANSLATED is set.
Glad you found the solution already.

Best Regards.
 
Top