|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21177 cgi shows header output with -q
Submitted: 2002-12-25 01:29 UTC Modified: 2002-12-25 14:41 UTC
From: philip at cornado dot com Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4CVS-2002-12-25 (stable) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: philip at cornado dot com
New email:
PHP Version: OS:


 [2002-12-25 01:29 UTC] philip at cornado dot com
I've been looking for PEBKAC but it doesn't seem to be the case.  Here's the commandline output (with some whitespace changes), this is latest checkout of the PHP_4_3 branch and also exists in HEAD:

rock:/cvs/a/php4# cat a.php
  print "Hello World\n";

rock:/cvs/a/php4# sapi/cgi/php -v
PHP 4.3.0-dev (cgi), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies

rock:/cvs/a/php4# sapi/cgi/php -q a.php
Content-type: text/html
X-Powered-By: PHP/4.3.0-dev

Hello World

rock:/cvs/a/php4# sapi/cli/php a.php
Hello World

rock:/cvs/a/php4# sapi/cgi/php -h
Usage: php [-q] [-h] [-s [-v] [-i] [-f <file>]
       php <file> [args...]
  -a               Run interactively
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse <file>.  Implies `-q'
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -q               Quiet-mode.  Suppress HTTP Header output.
  -s               Display colour syntax highlighted source.
  -v               Version number
  -w               Display source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.

And now from a PHP 4.2.3 CGI binary:

rock:/cvs/a/php4# php4 -v

rock:/cvs/a/php4# php4 a.php
X-Powered-By: PHP/4.2.3
Content-type: text/html

Hello World

rock:/cvs/a/php4# php4 -q a.php
Hello World



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-25 02:08 UTC]
Reproduced with HEAD
 [2002-12-25 03:34 UTC]

main/main.c seems to have added a second call to sapi_active with r1.515 which is reinitializing the sapi globals after they've been sent (in this case, 'headers_sent' being set to '1' by the -q option)

Checking with patch committer...
 [2002-12-25 14:41 UTC]
Fixed in cvs.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Aug 19 07:05:44 2022 UTC