FCGI Problem

FCGI Problem

Posted by: Darren996
Posted on: 2007-01-25 09:39:00

Hi,
I am having a problem with FCGI.

When I try and run index.php as a FCGI script I get a 500 error. Does anybody see anything obviously wrong here?

index.php
<html>
<head>
<title>Vortex</title>
</head>
<body>
<p>This is a test!</p>
<?php

$value = $value + 1;

echo "<p>Value is ".$value."</p>";

?>
</body>
</html>

.htaccess
#Everything rem'd out works (plain old Apache)

#Lighttpd works
#AddType application/x-httpd-php .php

#FCGI no worky
#Options +ExecCGI
#AddHandler fastcgi-script fcg fcgi fpl
#AddHandler php5-fastcgi .php
#Action php5-fastcgi /php5-wrapper.fcgi

Note I have rem'd everything out to make sure it works. If I unrem the
lighttp section it works. If I unrem the #FCGI section it doesn't work.

The wiki article says:

AddHandler fastcgi-script fcg fcgi fpl

when I think it should be this:

AddHandler fastcgi-script .fcg .fcgi .fpl

..or maybe it doesn't matter, either way it doesn't work.

php5-wrapper.fcgi
#!/bin/sh
export PHP_FCGI_CHILDREN=3
exec /dh/cgi-system/php5.cgi

I have done this test exactly to the dreamhost wiki as far as I can tell. There has to be something else wrong.

Thanks,
Darren

Re: FCGI Problem

Posted by: misoman
Posted on: 2007-01-25 10:39:00

Did you close your eyes and wish really hard that it would work? I've found that fixes about half the problems I have here.

The first time I set up FastCGI, I had the same problem as you. Double-checked my typing, made sure all my permissons were set correctly, and so on. Decided to call it a night and work on it the next day, and the following morning it auto-magically worked without changing a thing.

I guess the moral of the story is: sometimes it's not you that's the problem. Although it could be. I don't see any problems with what you posted, but maybe a more perceptive person will find a mistake there.

Edit: Upon examining my current setup, it looks like I included the dots in the AddHandler line. Don't know if it makes a difference or not:

AddHandler fastcgi-script .fcg .fcgi .fpl

Re: FCGI Problem

Posted by: Mousee
Posted on: 2007-01-25 12:13:00

You might also take a look at your error log for apache as well. In fact, if you could post a couple lines of output from there, it might help a bit.

However, php5-wrapper.fcgi needs to look like this:

In reply to:


#!/bin/sh
exec /usr/local/dh/cgi-system/php5.cgi



The .fcg .fcgi .fpl I'm not sure really matters.. but I guess it's also worth a shot.

You might also try recompiling, if you went with the custom PHP route, PHP5 to support pear (So remove the --without-pear line from the install script).
FCGI works nicely for me like that.

Re: FCGI Problem

Posted by: Darren996
Posted on: 2007-01-25 12:44:00

Hi Mousee,

Thanks for the reply. Here are a couple lines from my error log.

[Thu Jan 25 12:27:40 2007] [error] [client 64.16.133.141] FastCGI: comm with (dynamic) server "/home/vortex996/vortexsedona.com/php5-wrapper.fcgi" aborted: (first read) idle timeout (60 sec)
[Thu Jan 25 12:27:40 2007] [error] [client 64.16.133.141] FastCGI: incomplete headers (0 bytes) received from server "/home/vortex996/vortexsedona.com/php5-wrapper.fcgi"

I tried what you suggested. That must have not been it.

Interestingly some search engine is already looking for robots.txt. My broke test site has been up for like two days.

Thanks,
Darren

Edit:
I am not using a custom compiled php...Edited by Darren996 on 01/25/07 01:02 PM (server time).

Re: FCGI Problem

Posted by: Darren996
Posted on: 2007-01-26 01:18:00

It was CRLFs in my wrapper script. Anybody know of a good editor for XP that doesn't use CRLFs?

Re: FCGI Problem

Posted by: Mousee
Posted on: 2007-01-26 04:44:00

DOH! Glad you got it figured out.. cause I was out of ideas for you as well, heh.

In regards to editors, I'm not sure if you've tried Notepad++, but it would be something you're looking for.
The Sourceforge page for it is here smile


Re: FCGI Problem

Posted by: ardco
Posted on: 2007-01-26 04:53:00

In reply to:

some search engine is already looking for robots.txt. My broke test site has been up for like two days.


Sometimes they're quick, especially when you're not yet ready; they're slower when you're in a hurry. tongue

In reply to:

Anybody know of a good editor for XP that doesn't use CRLFs?


I'd suggest Cygwin and vi. laugh

Re: FCGI Problem

Posted by: misterhaan
Posted on: 2007-01-26 07:53:00

if you create a file on windows that has CRLF and then FTP it in ascii mode (which you should pretty much always do for text files), the CRLFs will get converted to LFs for you.

Re: FCGI Problem

Posted by: ardco
Posted on: 2007-01-26 08:01:00

There's a good chance using dos2unix on the file on the server would fix it up too.

Re: FCGI Problem

Posted by: Darren996
Posted on: 2007-01-26 08:06:00

I am using FileZilla. If there is a setting for that it's not on and I can't find it.

Re: FCGI Problem

Posted by: BUGabundo
Posted on: 2007-01-26 09:28:00

just edit with pspad, and use the statusbar to select the cr/cf type

Tags: fcgi