#47149 [Asn->Csd]: Recent CGI patches completely break functionality with Apache

From: Date: Mon, 19 Jan 2009 19:00:08 +0000
Subject: #47149 [Asn->Csd]: Recent CGI patches completely break functionality with Apache
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133023@lists.php.net to get a copy of this message
ID: 47149 Updated by: dsp@php.net Reported By: daniel dot gorski at develnet dot org -Status: Assigned +Status: Closed Bug Type: CGI related Operating System: Linux PHP Version: 5.3.0alpha3 Assigned To: dsp New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2009-01-19 12:59:36] jani@php.net David, you break, you fix. ;) ------------------------------------------------------------------------ [2009-01-19 12:36:44] daniel dot gorski at develnet dot org 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 this bug report at http://bugs.php.net/?id=47149&edit=1

« previous php.bugs (#133023) next »