php as cgi

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Captain Dondo

    php as cgi

    I am trying to use php 4.4.2 as a cgi scripting language. I am running
    a self-built linux distribution, with php 4.4.2 compiled from source.
    I am using the busybox web server, which doesn't have the ability to
    incorporate php as a module.

    The problem I am having is that php is insistent about sending

    X-Powered-By: PHP/4.4.2
    Content-type: text/html

    at the start instead of

    HTTP/1.0 200 OK
    Content-type: text/plain

    Any way I can get php to quit doing what it's doing and do what I think
    it should be doing?

    TIA,

    --Yan
  • Erwin Moller

    #2
    Re: php as cgi

    Captain Dondo wrote:
    [color=blue]
    > I am trying to use php 4.4.2 as a cgi scripting language. I am running
    > a self-built linux distribution, with php 4.4.2 compiled from source.
    > I am using the busybox web server, which doesn't have the ability to
    > incorporate php as a module.
    >
    > The problem I am having is that php is insistent about sending
    >
    > X-Powered-By: PHP/4.4.2[/color]

    Check php.ini. Search for
    expose_php = On
    [color=blue]
    > Content-type: text/html[/color]

    Look in php.ini
    Search for
    default_mimetyp e = "text/html"

    [color=blue]
    >
    > at the start instead of
    >
    > HTTP/1.0 200 OK
    > Content-type: text/plain
    >
    > Any way I can get php to quit doing what it's doing and do what I think
    > it should be doing?[/color]

    Yep. :-)
    Change php.ini

    You can also use ini_set() to overrule php.ini per script basis.

    Regards,
    Erwin Moller
    [color=blue]
    >
    > TIA,
    >
    > --Yan[/color]

    Comment

    • Iván Sánchez Ortega

      #3
      Re: php as cgi

      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1

      Captain Dondo wrote:
      [color=blue]
      > The problem I am having is that php is insistent about sending
      >
      > X-Powered-By: PHP/4.4.2
      > Content-type: text/html
      >
      > at the start instead of
      >
      > HTTP/1.0 200 OK
      > Content-type: text/plain
      >
      > Any way I can get php to quit doing what it's doing and do what I think
      > it should be doing?[/color]

      Hhhhmmm... Have you tried to... ?

      <?php

      header('HTTP/1.0 200 OK');
      header('Content-type: text/plain');

      ?>

      - --
      - ----------------------------------
      Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

      http://acm.asoc.fi.upm.es/~mr/ ; http://acm.asoc.fi.upm.es/~ivan/
      MSN:i_eat_s_p_a _m_for_breakfas t@hotmail.com
      Jabber:ivansanc hez@jabber.org ; ivansanchez@kde talk.net
      -----BEGIN PGP SIGNATURE-----
      Version: GnuPG v1.4.2 (GNU/Linux)

      iD8DBQFD30lA3jc Q2mg3Pc8RAvTqAJ 96rnWLqW8SThAGR Lx/p9WGTtkJSwCbBR6 J
      0lTiSmzLiRWmVYY L3SKVCfI=
      =JOrH
      -----END PGP SIGNATURE-----

      Comment

      • Marek Simon

        #4
        Re: php as cgi

        [color=blue]
        > Hhhhmmm... Have you tried to... ?
        >
        > <?php
        >
        > header('HTTP/1.0 200 OK');
        > header('Content-type: text/plain');
        >
        > ?>[/color]

        Header('Content-type: text/plain');
        is enough (usualy)
        Marek

        Comment

        • Tim Roberts

          #5
          Re: php as cgi

          Captain Dondo <yan@NsOeSiPnAe Mr.com> wrote:
          ?[color=blue]
          >I am trying to use php 4.4.2 as a cgi scripting language. I am running
          >a self-built linux distribution, with php 4.4.2 compiled from source.
          >I am using the busybox web server, which doesn't have the ability to
          >incorporate php as a module.
          >
          >The problem I am having is that php is insistent about sending
          >
          >X-Powered-By: PHP/4.4.2
          >Content-type: text/html
          >
          >at the start instead of
          >
          >HTTP/1.0 200 OK
          >Content-type: text/plain
          >
          >Any way I can get php to quit doing what it's doing and do what I think
          >it should be doing?[/color]

          Unless the script name starts with "nph-", the HTTP/1.0 line is the
          responsibility of the web server, not the CGI script. Of course, it's
          possible that the busybox web server never does the parsing that it's
          supposed to, in which case the 'header("HTTP/1.0 200 OK");' suggestion is
          the right one.

          The X-Powered-By line doesn't hurt anything. Content-Type does not have to
          be first.
          --
          - Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.

          Comment

          Working...