| Paul Blondé 2007-07-24, 7:01 pm |
| wait...are you saying that you are hosting your PHP on one machine, and =
your
Apache on another?
Does Apache+PHP support remoting like that?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paul Blond=E9
-----Original Message-----
From: Tony Shadwick [mailto:tshadwick+php.net@oss-solutions.com]=20
Sent: Tuesday, July 24, 2007 11:02 AM
To: php-install@lists.php.net
Subject: [PHP-INSTALL] php(5)-cgi + Apache2 + fastcgiexternalserver =3D =
lost
hair
Okie. I've been googling for days on this now, and I've come across=20
several PHP bug reports that basically say this is a configuration=20
error, and not a php bug. If that's true, I seriously need help.
On my web server box, I'm running Apache2.1, and in my httpd.conf file I =
have this:
FastCGIExternalServer /path/to/stub/fcgi-bin/php -host php-host:9000
Then in my Includes/site.conf (individual sites each have their own=20
config file), I have this:
AddHandler php-cgi .php
Action php-cgi /fcgi-bin/php
ScriptAlias /fcgi-bin/php ScriptAlias /fcgi-bin/php=20
/path/to/stub/fcgi-bin/php
Then I have a directive that adds +ExecCGI to the user's directory. So=20
far so good. Restart apache.
On the php-host box, I've compiled:
php5-5.2.3 PHP Scripting Language (Apache Module and CLI)
I start it using php-cgi -b 9000. The port accepts connections just=20
fine. When I go to browse to a simple script on my web host that has:
<?
phpinfo();
?>
I get "No input file specified." on screen, and in the logs I get what=20
oddly appears to be a 404 message:
172.16.12.2 - - [23/Jul/2007:22:27:12 -0500] "GET /phpinfo.php HTTP/1.1" =
404 25 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en)=20
AppleWebKit/419.2.1 (KHTML, like Gecko) Safari/419.3"
Except it's really not a 404. If I get rid of the php handler, it=20
returns the text of the script just fine.
I've googled this mess forwards and backwards, and what I come across is =
that there appears to be some sort of a tiff between PHP and web=20
servers, where web servers usually pass along the environment variable=20
SCRIPT_NAME, whereas PHP wants SCRIPT_FILENAME in order to determine=20
that it is running in cgi mode (I think?). I've done everything I can=20
think of to facilitate that. I've adjusted the relavent setting in=20
php.ini on the php host
cgi.fix_pathinfo=3D1
Restart the php-cgi binary, does no good. I've tried making mod-rewrite =
changes on apache2 to force SCRIPT_FILENAME to be assigned, that doesn't =
work. I've tried manually assigning a SCRIPT_FILENAME environment=20
variable on the shell that I'm executing php-cgi from. That too fails.
Out of desperation, I finally ran tcpdump -w ~/phpdump.txt -i em0 port=20
9000 on the php-cgi host. I won't bore you with everything that=20
wireshark says about it, rather, the most relevant part gets revealed by =
strings I think:
# strings ~/phpdump.txt
REDI
SCRIPT_NAME/fcgi-bin/
Status: 404
X-Powered
A few things stand out to me here: number one, SCRIPT_NAME appears to=20
be getting sent, 2 it looks like php-cgi is the one returning 404, not=20
the web server, and finally....this is getting a bit truncated, isn't=20
it? I'd fully expect to find the full X-Powered header there, and if=20
it's going to say /fcgi-bin/, I'd expect to find /fcgi-bin/php. and=20
REDI....?
Anyone have an idea what I can do to fix this up? The file DOES exist.=20
It'd currently chmod 777 to make sure it's not a permissions thing=20
(it's just phpinfo at this point anyway....). The traffic *is* being=20
sent to port 9000 on the php-cgi host. What else can I do?
Tony Shadwick
OSS Solutions
|