php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37133 PHP in FastCGI mode cannot connect to same Apache server using readfile()
Submitted: 2006-04-19 07:43 UTC Modified: 2006-06-20 15:07 UTC
From: ecarpenter at itex dot co dot za Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.4.2 OS: SuSE Linux 10.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ecarpenter at itex dot co dot za
New email:
PHP Version: OS:

 

 [2006-04-19 07:43 UTC] ecarpenter at itex dot co dot za
Description:
------------
If PHP is running in FastCGI mode and the php script, test.php, is being executed. The readfile() statement never returns. 
Note that both scripts are on the same server!

This above was test was done running php as an apache module (mod_php) and works 100%.

Reproduce code:
---------------
<?
//file test.php
readfile("http://localhost/info.php");
?>

<?
//info.php
phpinfo();
?>

Expected result:
----------------
The result generated by phpinfo() in info.php should be returned to test.php. test.php should then echo the result and should be displayed in the callee's browser

Actual result:
--------------
Http Error 500

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-19 10:12 UTC] ecarpenter at itex dot co dot za
I download the release, the same problem still exist.

I compiled PHP using the following settings:
/configure --prefix=/usr --datadir=/usr/share/php --mandir=/usr/share/man --bindir=/usr/bin --libdir=/usr/share --includedir=/usr/include --sysconfdir=/etc --with-_lib=lib --with-config-file-path=/etc --with-exec-dir=/usr/lib/php/bin --disable-debug --enable-inline-optimization --enable-memory-limit --enable-magic-quotes --enable-safe-mode --enable-sigchild --disable-ctype --disable-session --without-mysql --disable-cli --without-pear --with-openssl --enable-force-cgi-redirect --enable-fastcgi --bindir=/srv/www/cgi-bin 

The output after running php -v
PHP 4.4.3-dev (cgi-fcgi) (built: Apr 19 2006 11:52:46)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
 [2006-04-19 10:20 UTC] tony2001@php.net
What exactly is written in the error_log about it?
 [2006-04-19 11:04 UTC] ecarpenter at itex dot co dot za
The only errors found in the error log refers to timeout waiting for a reply. Note that the php server did not stop working and could handle new requests and even requests while the suspect one is in progress.

Below are the errors found in the error_log:
[Wed Apr 19 12:54:41 2006] [error] [client 127.0.0.1] FastCGI: comm with server "/srv/www/fcgi-bin/php-cgi" aborted: idle timeout (30 sec)
[Wed Apr 19 12:54:41 2006] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/srv/www/fcgi-bin/php-cgi"
[Wed Apr 19 12:54:41 2006] [error] [client 127.0.0.1] FastCGI: comm with server "/srv/www/fcgi-bin/php-cgi" aborted: idle timeout (30 sec)
[Wed Apr 19 12:54:41 2006] [error] [client 127.0.0.1] FastCGI: incomplete headers (0 bytes) received from server "/srv/www/fcgi-bin/php-cgi"
 [2006-04-19 11:06 UTC] tony2001@php.net
I can't reproduce it.
Please try to execute the same code using PHP CLI.
 [2006-04-19 14:13 UTC] ecarpenter at itex dot co dot za
If I configure the PHP application as a normal CGI handler everything works fine (just very slow)


-----------------
#Settings used to run as normal cgi
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php
DirectoryIndex index.php

-----------------
#fastcgi settings to recreate the problem

ScriptAlias /fcgi-bin/ /srv/www/fcgi-bin/
FastCgiIpcDir /var/lib/apache2/fastcgi
<Directory "/srv/www/fcgi-bin">
   AllowOverride None
   Options +ExecCGI -Includes
   Order allow,deny
   Allow from all
</Directory>

FastCgiServer /srv/www/fcgi-bin/php-cgi

#FastCGIExternalServer /srv/www/fcgi-bin/php-cgi  -host 127.0.0.1:8000
AddHandler php-fastcgi .php
Action php-fastcgi /fcgi-bin/php-cgi
DirectoryIndex index.php
 [2006-04-26 11:12 UTC] dmitry@php.net
How many PHP processes do you have?
Seems mod_fastcgi doesn't start additional process for sub-request and existing process is busy.

 [2006-04-26 11:28 UTC] ecarpenter at itex dot co dot za
I have only one PHP server process running. Would this imply that all the PHP execution requests send are all serialized on one "PHP server" for for processing?

It was my understanding that if the PHP applications is started as a server (-b :8000) it could handle multiple requests simultaneously , am I wrong?
 [2006-06-20 15:07 UTC] tony2001@php.net
Obviously only one server process cannot handle two simultaneous requests.
Not PHP problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 06:01:29 2024 UTC