Author |
|
James Blond Moderator

Joined: 19 Jan 2006 Posts: 7404 Location: EU, Germany, Next to Hamburg
|
Posted: Tue 21 Nov '06 10:42 Post subject: Running PHP as cgi causes HTTP 400 error |
|
|
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: 3117 Location: Hilversum, NL, EU
|
Posted: Tue 21 Nov '06 13:04 Post subject: |
|
|
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: 7404 Location: EU, Germany, Next to Hamburg
|
Posted: Tue 21 Nov '06 15:45 Post subject: |
|
|
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.
I removed everything from the module.
Maybe I try a fresh installation.....  |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3117 Location: Hilversum, NL, EU
|
Posted: Tue 21 Nov '06 15:53 Post subject: |
|
|
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: 7404 Location: EU, Germany, Next to Hamburg
|
Posted: Tue 21 Nov '06 17:38 Post subject: |
|
|
I still get the 400 error on some file and download the other files.  |
|
Back to top |
|
Brian
Joined: 21 Oct 2005 Posts: 209 Location: Puyallup, WA USA
|
Posted: Wed 22 Nov '06 1:38 Post subject: |
|
|
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: 7404 Location: EU, Germany, Next to Hamburg
|
Posted: Wed 22 Nov '06 10:41 Post subject: |
|
|
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
|
Posted: Wed 22 Nov '06 21:38 Post subject: |
|
|
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
|
Posted: Sun 18 Mar '07 17:01 Post subject: |
|
|
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: 7404 Location: EU, Germany, Next to Hamburg
|
Posted: Mon 19 Mar '07 10:43 Post subject: |
|
|
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 |
|