From:             daniel dot gorski at develnet dot org
Operating system: Linux
PHP version:      5.3.0alpha3
PHP Bug Type:     CGI related
Bug description:  Recent CGI patches completely break functionality with Apache

Description:
------------
The recent patch in sapi/cgi/cgi_main.c breaks the functionality with
Apache.

This is the culprit: <http://news.php.net/php.cvs/55503>

- if (env_path_translated != NULL && env_redirect_url != NULL) {
+ if (env_path_translated != NULL && env_redirect_url != NULL &&
+     orig_script_filename != NULL && script_path_translated != NULL &&
+     strcmp(orig_script_filename, script_path_translated) != 0) {

The result is, that Apache tries to *parse* the CGI binary as it would be
a PHP file. Requests to this CGI emit following:

Warning: Unexpected character in input: '' (ASCII=15) state=0 in
/mnt/dev/php-bin/cgi on line 356
Warning: Unexpected character in input: '' (ASCII=2) state=0 in
/mnt/dev/php-bin/cgi on line 356 Warning: Unexpected character in input: '
in /mnt/dev/php-bin/cgi on line 356
Warning: Unexpected character in input: ' in /mnt/dev/php-bin/cgi on line
356 Parse error: syntax error, unexpected T_STRING in /mnt/dev/php-bin/cgi
on line 356 

... where /mnt/dev/php-bin/cgi is the PHP CGI binary.

This used to work before the patch in question and works again if I revert
this patch.

The CGI configuration settings in my httpd.conf are staight forward:

  ScriptAlias /php-bin "/home/goosh/dev/php-bin"
  <Directory "/home/goosh/dev/php-bin">
      AllowOverride All
      Options All
      Order allow,deny
      Allow from all
  </Directory>
  <IfModule mod_cgi.c>
      AddHandler   php5-script .php .html
      Action       php5-script /php-bin/cgi
  </IfModule>

My Apache httpd version is Apache/2.2.8

regards dtg

Reproduce code:
---------------
-

Expected result:
----------------
Working PHP via the CG interface.

Actual result:
--------------
Trash, CGI not working.

-- 
Edit bug report at http://bugs.php.net/?id=47149&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47149&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47149&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47149&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47149&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47149&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47149&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47149&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47149&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47149&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47149&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47149&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47149&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47149&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47149&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47149&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47149&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47149&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47149&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47149&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47149&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47149&r=mysqlcfg

Reply via email to