Re: cgi-fcgi

"James M. Luedke" <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Ok so now my thoughts are A bit clearer on this whole issue.
the cgi-fcgi application will do nothing more than pass enviorment
variables to a fastcgi enabled program. In my case php is the fastcgi
program, as it was compiled with --enable-fastcgi.

So i have set up the following test and it appeares to be working.

# Start up php
 php-fcgi -b 127.0.0.1:9966

# Run my test shell script that calls cgi-fcgi
---
/root/test.php
Content-type: text/html
X-Powered-By: PHP/4.3.9

Hello World
---

# My two test files
--------------------------
/tmp/test.php
---
<?php echo "Hello World\n"; ?>
---

---
/root/test.sh
---
#!/bin/sh
export SCRIPT_FILENAME=/tmp/test.php
/usr/local/bin/cgi-fcgi -bind -connect 127.0.0.1:9966
--------------------------

So now I have a few new questions?
a.) Is this test logical?

b.) Am I invoking php correctly? What about the environment variable
PHP_FCGI_CHILDREN When I ran this test I only saw 1 php process.
I would expect to see 5 as that is the default value. Will php spawn those
new processes as needed or do I need to do some more magic elsewhere.

c.) How would I configure apache to use the cgi-fcgi program? (NOT 
mod_fastcgi)
this is my best guess at it.

AddHandler php-fastcgi .php
Action php-fastcgi <SOME COMMAND HERE>

Any help would be appreciated.
-James




James M. Luedke wrote:

> Hello:
>    I am attempting to write a small webserver, and want to try to 
> incorporate fcgi into it.
> While reading over the the developers documentation I found the the 
> section
> "Using cgi-fcgi with any webserver"
> http://www.fastcgi.com/devkit/doc/fcgi-devel-kit.htm#S4.2
> So my question is this. Can I somehow configure cgi-fcgi to run php 
> scripts?
> I know that php has fastcgi support. How would I go about this? The 
> example
> online confused me.
>
> If my understanding is correct I would need to bulid php with 
> --enable-fastcgi.
> Then I need to run php as a deamon to retain cache between pages hits?
> Then I would need to configure my webserver to run cgi-fcgi for all 
> *.php scripts
> on my server. Is that right?
>
> So here is what I have done to test if my understanding is ok
>
>
> I wrote a simple php page /tmp/test.php
>
> <?php
> echo "Hello World";
> ?>
> chmod 777 /tmp/test.php
>
> I built php with --enable-fastcgi than I ran it from command line
> ./php -b 127.0.0.1:9966
>
> Then I attempted to use cgi-fcgi to run test.php
>
> <degobah 10:54:34># /usr/local/bin/cgi-fcgi -connect 127.0.0.1:9966 
> /root/test.
> php
> Status: 404
> Content-type: text/html
> X-Powered-By: PHP/4.3.9
>
> No input file specified.
> <degobah 10:54:37>#
>
> So, any idea on where my disconnect is? Am I starting php correctly, 
> am I envoking cgi-fcgi correctly?
>
> Thanks,
> -James
>
> ___________________________________
> fastcgi-developers mailing list
> http://fastcgi.com/fastcgi-developers/
>

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.