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: Running PHP as cgi causes HTTP 400 error
Author
James Blond
Moderator


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

PostPosted: Tue 21 Nov '06 10:42    Post subject: Running PHP as cgi causes HTTP 400 error Reply with quote

ScriptAlias /php/ "C:/server2/php/"
Action application/x-httpd-php "C:/php/php-cgi.exe"
AddType application/x-httpd-php .php
SetEnv PHPRC "C:/servers/apache/php"

<Directory "C:/server2/php">
Options ExecCGI FollowSymLinks
Allow from all
Order allow,deny
AllowOverride None
</Directory>

Running PHP as cgi causes HTTP 400 error
I'm running on XP Pro Apache 2.2.3 PHP 5.2.0
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3057
Location: Hilversum, NL, EU

PostPosted: Tue 21 Nov '06 13:04    Post subject: Reply with quote

Any thing in the php.log and/or error.log ?

Any leftovers in httpd.conf of php installed as module ?

You can try:

ScriptAlias /php/ "C:/server2/php/"
Action application/x-httpd-phpc "/php/php-cgi.exe"
AddType application/x-httpd-php .php
SetEnv PHPRC C:/servers/apache/php

Steffen
Back to top
James Blond
Moderator


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

PostPosted: Tue 21 Nov '06 15:45    Post subject: Reply with quote

In my error log I get
[error] Invalid URI in request GET /phpinfo.php HTTP/1.1, referer: http://127.0.0.1/

Some scripts causes a download and the download contains the php-cgi.exe so after rename that file to e.g. test.exe I can run it. Shocked

I removed everything from the module.
Maybe I try a fresh installation..... Confused
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3057
Location: Hilversum, NL, EU

PostPosted: Tue 21 Nov '06 15:53    Post subject: Reply with quote

What happens when you change:


<Directory "C:/server2/php">
Options ExecCGI FollowSymLinks
Allow from all
Order allow,deny
AllowOverride None
</Directory>

To:

<Directory "/">
Options ExecCGI FollowSymLinks
AllowOverride None
</Directory>
Back to top
James Blond
Moderator


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

PostPosted: Tue 21 Nov '06 17:38    Post subject: Reply with quote

I still get the 400 error on some file and download the other files. Neutral
Back to top
Brian



Joined: 21 Oct 2005
Posts: 209
Location: Puyallup, WA USA

PostPosted: Wed 22 Nov '06 1:38    Post subject: Reply with quote

Here is my setup for FastCGI:

Code:
LoadModule fcgid_module modules/mod_fcgid.so

<IfModule mod_fcgid.c>

   IPCCommTimeout 40
   IPCConnectTimeout 10
   MaxProcessCount 8
   OutputBufferSize 64
   ProcessLifeTime 240
   MaxRequestsPerProcess 500
   
   <Directory C:/www/FCGI>   
      AddHandler fcgid-script .php
      Options Indexes FollowSymLinks ExecCGI
      FCGIWrapper "c:/apache2/PHP_FCGI/php-cgi.exe" .php
      AllowOverride all
      Order allow,deny
      Allow from all
      Satisfy any
   </Directory>

</IfModule>


...and really there are no other settings for my server using FCGI, oh I did have some ENV VARS set but they are not important for this example. Even as you see this, it runs properly on my testing server.

Have you attempted Fast CGI as an alternative? I suspect there are few if any negatives for most situations (though I can think of a couple where FCGI may not work).
Back to top
James Blond
Moderator


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

PostPosted: Wed 22 Nov '06 10:41    Post subject: Reply with quote

Ok! That works! But only in that subfolder.
I can't put the wrapper into the normal htdocs.
Back to top
Brian



Joined: 21 Oct 2005
Posts: 209
Location: Puyallup, WA USA

PostPosted: Wed 22 Nov '06 21:38    Post subject: Reply with quote

I would imagine that you can apply this to any directory by changing the <Directory C:/www/FCGI> line in the settings above and ensuring you have a vhost set up for that directory.
Back to top
Kanashii



Joined: 17 Jul 2006
Posts: 155
Location: Porando

PostPosted: Sun 18 Mar '07 17:01    Post subject: Reply with quote

The same error but 404:

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule mod_fcgid.c>

DefaultInitEnv PHPRC "C:/PHP/"
DefaultInitEnv PATH "C:/PHP/;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
DefaultInitEnv SystemRoot "C:/Windows"
DefaultInitEnv SystemDrive "C:"
DefaultInitEnv TEMP "C:/WINDOWS/TEMP"
DefaultInitEnv TMP "C:/WINDOWS/TEMP"
DefaultInitEnv windir "C:/WINDOWS"

IPCCommTimeout 40
IPCConnectTimeout 10
MaxProcessCount 8
OutputBufferSize 64
ProcessLifeTime 240
MaxRequestsPerProcess 500

<Directory "C:/httdocs">
AddHandler fcgid-script .php
Options +FollowSymLinks +ExecCGI
FCGIWrapper "C:/PHP/php-cgi.exe" .php
AllowOverride all
Order allow,deny
Allow from all
Satisfy any
</Directory>

</IfModule>

#LoadModule php5_module "C:/PHP/php5apache2_2.dll"
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .php5 .phtml
PHPIniDir "C:/PHP/"
</IfModule>
Back to top
James Blond
Moderator


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

PostPosted: Mon 19 Mar '07 10:43    Post subject: Reply with quote

Kanashii wrote:
The same error but 404:


404 is different! 4045 means that the file is not found. Consult your error where apache tried to find the file.
Back to top


Reply to topic   Topic: Running PHP as cgi causes HTTP 400 error View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules