logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: Problem with mod_fcgid & PHP $_SERVER variables
Author
mpiche



Joined: 10 Apr 2008
Posts: 9

PostPosted: Fri 22 Jul '11 16:41    Post subject: Problem with mod_fcgid & PHP $_SERVER variables Reply with quote

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

PostPosted: Fri 22 Jul '11 17:27    Post subject: Reply with quote

in your httpd.conf also add
Code:

FcgidFixPathinfo 1


and in your php.ini set
Code:

cgi.fix_pathinfo=1
Back to top
mpiche



Joined: 10 Apr 2008
Posts: 9

PostPosted: Fri 22 Jul '11 17:52    Post subject: Reply with quote

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 :
Code:
FcgidFixPathinfo 0


php.ini :
Code:
cgi.fix_pathinfo=0

Thanks.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Fri 22 Jul '11 23:41    Post subject: Reply with quote

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

PostPosted: Tue 07 Jan '14 13:01    Post subject: Reply with quote

For the record,
with my last WAMP installations I had to use

in apache
Code:

FcgidFixPathinfo 0


and in php.ini
Code:

cgi.fix_pathinfo = 1
Back to top
CamaroSS



Joined: 24 Jan 2013
Posts: 78
Location: RF, Tver

PostPosted: Wed 08 Jan '14 12:37    Post subject: Reply with quote

James Blond wrote:

in apache
Code:

FcgidFixPathinfo 0


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

PostPosted: Wed 22 Jan '14 20:04    Post subject: Reply with quote

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

PostPosted: Thu 23 Jan '14 22:07    Post subject: Reply with quote

John Dog wrote:


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


Thank you for the hint! I've updated that topic.
Back to top


Reply to topic   Topic: Problem with mod_fcgid & PHP $_SERVER variables View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules