[CLI] HTML output even with -q switch?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gilles Ganault

    #1

    [CLI] HTML output even with -q switch?

    Hello

    I need to write PHP scripts on an AstLinux distribution. Even
    though I added the "-q" switch on the shebbang line, PHP still outputs
    some HTML:

    ==========
    # cat test.php

    #!/usr/bin/php -q
    <?php
    echo "test";
    ?>
    ==========
    # ./test.php
    X-Powered-By: PHP/5.2.5
    Content-type: text/html

    test#
    ==========

    Is there a switch somewhere to tell PHP to actually run scripts
    quietly, or is it just the way PHP works when called from mini-httpd?

    FWIW, here's phpinfo:

    PHP Logo PHP Version 5.2.5 System Linux pbx 2.6.20.21-astlinux #1 PREEMPT Fri Jan 25 00:49:32 CET 2008 i586 Build Date Jan 25 2008 00:54:00 Configure Command…


    Thank you.
  • AnrDaemon

    #2
    Re: [CLI] HTML output even with -q switch?

    Greetings, Gilles Ganault.
    In reply to Your message dated Friday, January 25, 2008, 08:56:14,
    I need to write PHP scripts on an AstLinux distribution. Even
    though I added the "-q" switch on the shebbang line, PHP still outputs
    some HTML:
    ==========
    # cat test.php
    #!/usr/bin/php -q
    <?php
    echo "test";
    ?>>
    ==========
    # ./test.php
    X-Powered-By: PHP/5.2.5
    Content-type: text/html
    You're using CGI, not CLI version.
    CLI version will NEVER output a HTTP header.
    Also try the "php --help" and see if that switch exists at all.
    test#
    ==========
    Is there a switch somewhere to tell PHP to actually run scripts quietly,
    "quiet" mode is NOT supposed to hide output at all.
    It is in the best case will hide any PHP engine(!) generated messages, but
    YOUR OWN output will be indeed written.
    or is it just the way PHP works when called from mini-httpd?
    It is just how's it intended to work. If You don't want any output from script
    - remove any output-generating commands from script or enclose it in
    conditional checks.


    --
    Sincerely Yours, AnrDaemon <anrdaemon@free mail.ru>

    Comment

    • Gilles Ganault

      #3
      Re: [CLI] HTML output even with -q switch?

      On Fri, 25 Jan 2008 09:44:50 +0300, AnrDaemon <anrdaemon@free mail.ru>
      wrote:
      >You're using CGI, not CLI version.
      >CLI version will NEVER output a HTTP header
      Yup, I looked at the configuration script, and this is the CGI
      version:

      PHP5_BINARY:=sa pi/cgi/php-cgi

      Is it possible to compile both the CLI and CGI versions? I don't see
      any "--enable-cli" or "--disable-cli" option in the same file.

      Thanks.

      Comment

      Working...