|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2002-09-29 07:22 UTC] elk at model-fx dot com
  [2002-10-28 10:46 UTC] iliaa@php.net
  [2002-10-28 18:51 UTC] elk at model-fx dot com
  [2002-11-13 01:00 UTC] php-bugs at lists dot php dot net
  [2002-11-13 12:30 UTC] sniper@php.net
  [2002-11-26 19:58 UTC] sniper@php.net
  [2007-05-30 01:22 UTC] kingsizewhopper at hotmail dot com
  [2009-11-29 03:19 UTC] reyesalejandre at gmail dot com
  [2009-12-07 06:33 UTC] matt dot adams at cypressinteractive dot com
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Thu Oct 30 22:00:01 2025 UTC | 
When running PHP under FastCGI (with Suexec wrapper enabled), the variables _SERVER["SCRIPT_NAME"] and _SERVER["SCRIPT_FILENAME"] are returning the path and filename of the PHP-FCGI binary instead of the path and filename of the current executing script, that is, the values of _ENV["SCRIPT_NAME"] and _ENV["SCRIPT_FILENAME"] respectively. This breaks a lot of scripts relying on just $SCRIPT_NAME and $SCRIPT_FILENAME; ie, when setting up this in httpd.conf : ScriptAlias /fcgi-bin/ /usr/local/apache/bin/ <Location /fcgi-bin/> SetHandler fastcgi-script </Location> AddType application/x-httpd-php .php .php3 .php4 Action application/x-httpd-php /fcgi-bin/php.fcgi When called from a script, $SCRIPT_NAME becomes : /fcgi-bin/php.fcgi $SCRIPT_FILENAME becomes : /usr/local/apache/bin/php.fcgi Versions : PHP 4.2.3 compiled with --with-fastcgi mod_fastcgi 2.2.12 Apache 1.3.26 I modified sapi/fastcgi.c to register the correct _SERVER vars, and it works OK. At line 164, add : php_register_variable("SCRIPT_NAME", (SG(request_info).request_uri ? SG(request_info).request_uri:""), track_vars_array TSRM LS_CC); php_register_variable("SCRIPT_FILENAME", (SG(request_info).path_translated ? SG(request_info).path_translated:""), track_var s_array TSRMLS_CC); Best, elk@model-fx.com