php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11430 PHP-CGI executing PHP-CGI thru Apache
Submitted: 2001-06-12 06:49 UTC Modified: 2002-08-20 08:39 UTC
From: allanh at netcentralen dot dk Assigned:
Status: Closed Package: Program Execution
PHP Version: 4.3.0-dev OS: Linux 2.4 (RH7.3 upd kernel)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: allanh at netcentralen dot dk
New email:
PHP Version: OS:

 

 [2001-06-12 06:49 UTC] allanh at netcentralen dot dk
PHP is run as a CGI script. Error does not occur when PHP is run as Apache module.
I have reproduced error on three different systems.


file: test.php
=== cut ===
<?
echo "Ho! ";
echo `./test`;
?>
=== uncut ===

file: test
=== cut ===
#!/usr/local/bin/php -q 
<?
echo "Ha!";
?>
=== uncut ===


When running 
php -q < test.php.
output is correct:  "Ho! Ha!"


When requesting test.php through apache, output is as follows:

Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! X-Powered-By: PHP/4.0.5 Content-type: text/html Ho! 


---------------------------

PHP configure string:
./configure -with-mysql --enable-force-cgi-redirect --with-gdbm --enable-ftp 

php.ini is empty.


Apache version: 1.3.19 (also tested 1.3.9)

Also tested FreeBSD 4.3 with Apache 1.3.19, same problem.

Also tested PHP 4.0.0 and 4.0.2, same problem.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-12 13:12 UTC] sniper@php.net
I can reproduce this with 4.0.6RC3 too.

 [2002-07-03 07:26 UTC] sander@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2002-07-03 08:29 UTC] allanh at netcentralen dot dk
When I reported the bug I used the latest version.
I just tested again and this now it no longer terminates by itself. It crashed the server. Error messages on the screen saying out of memory -- killed httpd.

It is a different server.
 [2002-07-03 19:10 UTC] sniper@php.net
I tried it too..and almost had my server crashed. 
I guess the php binary used in httpd.conf is same as
in the 'test' script?

 [2002-07-04 01:15 UTC] allanh at netcentralen dot dk
yes
 [2002-08-20 08:39 UTC] edink@php.net
The problem is that php-cgi reads the environmental variables set by apache, to find the correct script to execute, etc. This means that the php-cgi binary that is executed from the cgi script will also try to execute the original cgi scripts.

The solution is to use php-cgi binary for executing cgi scripts through apache and php-cli binary for executing command line scripts (including those called withing the cgi script).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 25 07:01:31 2024 UTC