Author |
|
mpiche
Joined: 10 Apr 2008 Posts: 9
|
Posted: Fri 22 Jul '11 16:41 Post subject: Problem with mod_fcgid & PHP $_SERVER variables |
|
|
I'm trying to use PHP with mod_fcgid instead of an apache module. Everything seems to work perfectly, but i'm having problem with some PHP $_SERVER variables.
With PHP as a module :
$_SERVER["PHP_SELF"] = /admin/phpinfo.php
$_SERVER["SCRIPT_NAME"] = /admin/phpinfo.php
With PHP as mod_fcgid :
$_SERVER["PHP_SELF"] = D:/admin/phpinfo.php
$_SERVER["SCRIPT_NAME"] = D:/admin/phpinfo.php
The drive "D:" is added to these 2 variables when i'm using mod_fcgid (my apache document_root is "D:\htdocs\").
My server is Apache/2.2.19 (Win32) mod_ssl/2.2.19 OpenSSL/1.0.0d mod_fcgid/2.3.6 with PHP 5.3.6. Apache 2.2.19 and mod_fcgid are the ones from apacheLounge.
My mod_fcgid config is the following :
Code: | FcgidIOTimeout 300
FcgidBusyTimeout 300
FcgidConnectTimeout 10
FcgidMaxProcesses 16
FcgidOutputBufferSize 65536
FcgidProcessLifeTime 3600
FcgidMaxRequestsPerProcess 500
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 500
FcgidFixPathinfo 1
FcgidInitialEnv PHPRC "c:/php/"
FcgidInitialEnv PATH "c:/php;C:/Apache2/bin;C:/WINDOWS/system32;C:/WINDOWS"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/TEMP"
FcgidInitialEnv TMP "C:/WINDOWS/TEMP"
FcgidInitialEnv windir "C:/WINDOWS"
FcgidInitialEnv PHP_FCGI_CHILDREN 0
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "c:/php/php-cgi.exe" .php
</Files> |
Thanks. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 22 Jul '11 17:27 Post subject: |
|
|
in your httpd.conf also add
and in your php.ini set
|
|
Back to top |
|
mpiche
Joined: 10 Apr 2008 Posts: 9
|
Posted: Fri 22 Jul '11 17:52 Post subject: |
|
|
Thanks for your help. FcgidFixPathinfo and cgi.fix_pathinfo were already at 1 in my config like your suggestion. I've tried to change both values to 0 and my problem is now gone. Is it ok ?
My actual values are :
httpd.conf :
php.ini :
Thanks. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 22 Jul '11 23:41 Post subject: |
|
|
Setting it to 1 should fix it. I wonder. But if now your problem is fixed keep it that way. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 07 Jan '14 13:01 Post subject: |
|
|
For the record,
with my last WAMP installations I had to use
in apache
and in php.ini
Code: |
cgi.fix_pathinfo = 1
|
|
|
Back to top |
|
CamaroSS
Joined: 24 Jan 2013 Posts: 78 Location: RF, Tver
|
Posted: Wed 08 Jan '14 12:37 Post subject: |
|
|
James Blond wrote: |
in apache
and in php.ini
Code: |
cgi.fix_pathinfo = 1
|
|
The same works for me. |
|
Back to top |
|
John Dog
Joined: 22 Jan 2014 Posts: 1
|
Posted: Wed 22 Jan '14 20:04 Post subject: |
|
|
I'm using Apache 2.4.7 on Windows and PHP 5.5.7.
Having "FcgidFixPathinfo 1" in my httpd.conf file always results in an incorrect value for $_SERVER['SCRIPT_NAME'], regardless of the value of cgi.fix_pathinfo in the php.ini file.
Removing/commenting the line, or explicitly setting FcgidFixPathinfo to 0 always results in a correct value for $_SERVER['SCRIPT_NAME'], regardless of the value of cgi.fix_pathinfo in the php.ini file.
Therefore I think this line ("FcgidFixPathinfo 1") should be removed from the tutorial on how to install Apache PHP MySQL etc: http://www.apachelounge.com/viewtopic.php?t=2394 |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 23 Jan '14 22:07 Post subject: |
|
|
Thank you for the hint! I've updated that topic. |
|
Back to top |
|