Re: Problem with PHP-FastCGI and fopening .php?

Stefan Wendt <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Message-ID <[email protected]>
Hi Gary,

When you are on this server, does
wget http://127.0.0.1/index.php
work?

When you run a
wget http://127.0.0.1/fopen.php
do you see both hits (fopen.php and index.php) in
the access logfile?

Does your apache fcgi_pm spawn multiple php processes?
If fcgi_pm fails to automatically spawn multiple instances, then
you can only serve one php request at any time and your
process would end up in a deadlock (and finally timeout after 30 secs).
(HTML would work though, because HTML is handled directly by Apache)

Stefan Wendt

Gary Griffith wrote:

> Hi List,
>
> I am having trouble with the PHP "fopen" function - but only within a 
> FastCGI-enabled PHP.  I have two setups on a Fedora Core v4 box, 
> Apache v2.0.55, PHP v4.4.2, and mod_fastcgi v2.4.2.  One Apache2.0.55 
> setup uses PHP as a DSO and one I have PHP running in FastCGI mode.  
> For the test, I have a index.php which consists of:
>
> <?php echo "This is a PHP page"; ?>
>
> I want to call index.php from another PHP page, fopen.php which I made 
> like:
>
> <?php
> $handle = fopen("http://127.0.0.1/index.php", "r");
> echo "FOPEN Ran fine";
> ?>
>
> When I hit http://server/fopen.php while running the DSO, Apache's 
> returns fopen.php fine.
>
> When I run Apache/FastCGI/PHP and hit fopen.php, I see Apache's 
> error_log spill the
> "FastCGI: comm with server "/usr/local/apache2/cgi-bin/php" aborted: 
> idle timeout (30 sec)."
> "FastCGI: incomplete headers (0 bytes) received from server"
>
> Apache's access_log shows HTTP 500 errors, you get the picture.
>
> Now - interesting to me is the fact that if I change fopen.php to 
> fopen a HTML file, it returns fine (HTTP 200 OK), I see that fopen.php 
> opens index.html, gets data and HTTP 200 yadda yadda.
>
> So - has anyone any insight as to why a FastCGI-PHP can fopen HTML but 
> not a PHP page?
>
> Wait, I knew you were going to ask that:
>
>         FastCgiServer /usr/local/apache2/cgi-bin/php
>         AddHandler php-fastcgi .php
>         <Location /cgi-bin/php>
>             SetHandler fastcgi-script
>         </Location>
>         Action php-fastcgi /cgi-bin/php
>         DirectoryIndex index.html index.shtml index.cgi index.php
>         AddType application/x-httpd-php .php
>
> is what I have added to my FastCGI-PHP Apache's httpd.conf.
>
> Thanks for any help on this!
> -Gary
>
>------------------------------------------------------------------------
>
>___________________________________
>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.