I'm using Apache 2.4.7 and PHP 5.5.7.
I have a test.php
file in C:\web\vhosts\Symfony\web
.
The value of $_SERVER['SCRIPT_FILENAME']
is correct:
C:/web/vhosts/Symfony/web/test.php
However the value of $_SERVER['SCRIPT_NAME']
depends on how I load PHP:
If I load PHP as an Apache module, the value of $_SERVER['SCRIPT_NAME']
is:
/test.php
I'm a bit surprised that it isn't the same as SCRIPT_FILENAME
, but at least it's a correct value, I guess.
Here's how I loaded PHP:
LoadModule php5_module "C:/web/php-5.5.7-Win32-VC11-x86/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/web/php-5.5.7-Win32-VC11-x86"
If I load PHP using mod_fcgid, the value of $_SERVER['SCRIPT_NAME']
is:
C:/test.php
Which is just wrong...
Here's how I loaded PHP (based on a tutorial from ApacheLounge):
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule fcgid_module>
FcgidIOTimeout 40
FcgidConnectTimeout 10
FcgidMaxProcesses 300
FcgidMaxProcessesPerClass 300
FcgidOutputBufferSize 64
ProcessLifeTime 0
FcgidMaxRequestsPerProcess 0
FcgidMinProcessesPerClass 0
FcgidFixPathinfo 1
FcgidProcessLifeTime 0
FcgidZombieScanInterval 20
FcgidMaxRequestLen 536870912
FcgidIOTimeout 120
FcgidTimeScore 3
FcgidPassHeader Authorization
FcgidInitialEnv PHPRC "C:\\web\\php-5.5.7-Win32-VC11-x86"
FcgidInitialEnv PATH "C:\\web\\php-5.5.7-Win32-VC11-x86;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
FcgidInitialEnv SystemRoot "C:\\Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
FcgidInitialEnv windir "C:\\WINDOWS"
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/web/php-5.5.7-Win32-VC11-x86/php-cgi.exe" .php
</Files>
</IfModule>
What's wrong with this setup?