php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24502 Fast CGI interface is broken
Submitted: 2003-07-04 16:53 UTC Modified: 2010-11-19 01:13 UTC
Votes:3
Avg. Score:4.3 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: gwang at litespeedtech dot com Assigned: shane (profile)
Status: Closed Package: *General Issues
PHP Version: 4.3.4 dev OS: Linux
Private report: No CVE-ID: None
 [2003-07-04 16:53 UTC] gwang at litespeedtech dot com
Description:
------------
Fast CGI interface is broken in both 4.3.2 4.3.3rc1 and the most recent snap shot for web server with Fast CGI implementation that follows CGI specification.
Our LiteSpeed web server (at http://www.litespeedtech.com ) supports PHP through the Fast CGI interface (faster than Apache's mod_php). Our Fast CGI implementation follows the CGI specification and set environment variables exactly as what Apache's CGI does. It set SCRIPT_FILENAME=/docroot/info.php and works fine with 4.3.1, but the interface is broken since 4.3.2.
Our test shows that 
SG(request_info).path_translated 
is not populated with the value of SCRIPT_FILENAME but is NULL.
Further study shows that the root cause is at cgi-main.c:812 in release 4.3.2
> script_path_translated=env_path_translated;
set script_path_translated to NULL or whatever the value of PATH_TRANSLATED. If we take that line out, every thing works fine.
We can use --enable-discard-path to avoid it but it is forbidden in README.FastCGI (We don't know why based on our reading of the source code).
I think one possilbe fix is to avoid that line of code for FastCGI, but may need to add some code for Apache's mod_fastcgi. Or change the document, say: --enable-discard-path should be used for web server follows CGI Specs.  

Sincerely,
LiteSpeed Team
 


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-29 21:48 UTC] sniper@php.net
Read the note above the cgi.fix_pathinfo in php.ini-dist (found in the release tarball). There is no bug.

 [2003-09-30 11:19 UTC] gwang at litespeedtech dot com
I did read the comments, my understanding is that  PATH_TRANSLATED will be fixed to conform to the CGI spec if it does not. It is great for those guys who do not follow CGI spec. 

The problem is when CGI spec has been followed, PATH_TRANSLATED is the translated PATH_INFO, SCRIPT_FILENAME is the path to the PHP script, enabling fix_pathinfo will clear PATH_INFO and PATH_TRANSLATED (set them to NULL), it will be a disaster for CGI script needs PATH_INFO. 

fix_pathinfo and discar_path is not necessary at all when the spec has been followed.

If you want, try it with our web server, it only take about 5 minutes to install, PHP (4.3.1) works out of box without any additional configuration. Just replace lsws/fcgi-bin/php with new PHP executable.

Thanks,
Litespeed
 [2010-11-19 01:13 UTC] jani@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Aug 14 19:01:27 2024 UTC