Undefined index: HTTP_HOST

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

    Undefined index: HTTP_HOST

    Undefined index: HTTP_HOST

    This occurs sometimes, is there a reliable method for determining
    the HTTP_HOST. Not sure if this is something related to Apache or
    if it's a problem with the version of PHP.

    Apache version 1.3.37
    PHP version 5.2.4

    I'm currently searching for an upgrade to Apache.

    --
    JC
    Natural Cure For Pink-Eye (Conjunctivitis )



  • Dikkie Dik

    #2
    Re: Undefined index: HTTP_HOST

    JC wrote:
    Undefined index: HTTP_HOST
    >
    This occurs sometimes, is there a reliable method for determining
    the HTTP_HOST. Not sure if this is something related to Apache or
    if it's a problem with the version of PHP.
    >
    Apache version 1.3.37
    PHP version 5.2.4
    >
    I'm currently searching for an upgrade to Apache.
    >
    From the top of my head, The HTTP_HOST is the host: header that is
    compulsory for HTTP/1.1 requests. What you experience are probably
    HTTP/1.0 requests. Nothing to do with either apache or PHP.

    Best regards

    Comment

    • Jerry Stuckle

      #3
      Re: Undefined index: HTTP_HOST

      JC wrote:
      Undefined index: HTTP_HOST
      >
      This occurs sometimes, is there a reliable method for determining
      the HTTP_HOST. Not sure if this is something related to Apache or
      if it's a problem with the version of PHP.
      >
      Apache version 1.3.37
      PHP version 5.2.4
      >
      I'm currently searching for an upgrade to Apache.
      >
      Are you running PHP as a module or CGI? There are some values which
      aren't defined in the CGI. I don't recall offhand if HTTP_HOST is one
      of them (I use modules).

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Jerry Stuckle

        #4
        Re: Undefined index: HTTP_HOST

        Jerry Stuckle wrote:
        JC wrote:
        >Undefined index: HTTP_HOST
        >>
        >This occurs sometimes, is there a reliable method for determining
        >the HTTP_HOST. Not sure if this is something related to Apache or
        >if it's a problem with the version of PHP.
        >>
        >Apache version 1.3.37
        >PHP version 5.2.4
        >>
        >I'm currently searching for an upgrade to Apache.
        >>
        >
        Are you running PHP as a module or CGI? There are some values which
        aren't defined in the CGI. I don't recall offhand if HTTP_HOST is one
        of them (I use modules).
        >
        Aw, @#$%. Forget what I said. It's been a long day. It very well
        could be HTTP 1.0 is being used. Check your apache access logs and see
        what they say.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • JC

          #5
          Re: Undefined index: HTTP_HOST

          JC wrote:
          Undefined index: HTTP_HOST
          >
          This occurs sometimes, is there a reliable method for determining
          the HTTP_HOST. Not sure if this is something related to Apache or
          if it's a problem with the version of PHP.
          >
          Server version: Apache/1.3.34 (Win32) <- CORRECTED. Is NOT 1.3.37.
          PHP version 5.2.4
          >
          I'm currently searching for an upgrade to Apache.
          >
          "Jerry Stuckle" replied...
          It could be HTTP 1.0 is being used. Check your apache access logs
          and see what they say.
          PHP is installed and run as/through a DLL ("ISAPI" is the IIS term,
          right, or does that applie to Apache too?).

          Yes, thanks. I could not find the access in the Apache logs. I
          corrected the Apache version above. It's time to install version 2,
          instead of hanging onto the version 1. I've run version on other
          systems in the recent past.

          I did get Internet Explorer to throw HTTP 1.0 headers, so I tested that.

          $_SERVER['HTTP_HOST'] displays properly. So I'm limiting what's going
          on to one of the following:

          (1)
          Someone is accessing through another server where I can't get HTTP_HOST
          headers. Don't know exactly how that happens so I'm just throwing out
          pure conjecture here.

          (2)
          There's an HTTP_HOST problem with a current version of PHP.

          (3)
          There's an HTTP_HOST problem with Apache. I hesitate to mention Apache
          because this has been happened on different versions of Apache (including
          version 2.2.x which I recently tested).

          (4)
          The HTTP_HOST header gets lost somewhere, sometimes.

          I only recently started using $_SERVER['HTTP_HOST'] and the problems show
          up in the PHP error logs. So far I have not been able to identify where
          it ended up logged in the Apache logs.

          Is there another way to identify which host gets connected to (PHP question)?

          Has anyone else noticed such? Maybe it's been happening all along, and it's
          only because I just started relying upon it to identify the domain-name that
          gets connected to. I would like to host 12 domains using one page which uses
          HTTP_HOST to identify which VirtualHost was connected to.

          Thanks for ANY and ALL suggestions, replies, hints, comments.

          --
          JC
          Natural Cure For Pink-Eye (Conjunctivitis )





          Comment

          • Jerry Stuckle

            #6
            Re: Undefined index: HTTP_HOST

            JC wrote:
            JC wrote:
            >Undefined index: HTTP_HOST
            >>
            >This occurs sometimes, is there a reliable method for determining
            >the HTTP_HOST. Not sure if this is something related to Apache or
            >if it's a problem with the version of PHP.
            >>
            >Server version: Apache/1.3.34 (Win32) <- CORRECTED. Is NOT 1.3.37.
            >PHP version 5.2.4
            >>
            >I'm currently searching for an upgrade to Apache.
            >>
            >
            "Jerry Stuckle" replied...
            >It could be HTTP 1.0 is being used. Check your apache access logs
            >and see what they say.
            >
            PHP is installed and run as/through a DLL ("ISAPI" is the IIS term,
            right, or does that applie to Apache too?).
            >
            Yes, thanks. I could not find the access in the Apache logs. I
            corrected the Apache version above. It's time to install version 2,
            instead of hanging onto the version 1. I've run version on other
            systems in the recent past.
            >
            I did get Internet Explorer to throw HTTP 1.0 headers, so I tested that.
            >
            $_SERVER['HTTP_HOST'] displays properly. So I'm limiting what's going
            on to one of the following:
            >
            (1)
            Someone is accessing through another server where I can't get HTTP_HOST
            headers. Don't know exactly how that happens so I'm just throwing out
            pure conjecture here.
            >
            (2)
            There's an HTTP_HOST problem with a current version of PHP.
            >
            (3)
            There's an HTTP_HOST problem with Apache. I hesitate to mention Apache
            because this has been happened on different versions of Apache (including
            version 2.2.x which I recently tested).
            >
            (4)
            The HTTP_HOST header gets lost somewhere, sometimes.
            >
            I only recently started using $_SERVER['HTTP_HOST'] and the problems show
            up in the PHP error logs. So far I have not been able to identify where
            it ended up logged in the Apache logs.
            >
            Is there another way to identify which host gets connected to (PHP question)?
            >
            Has anyone else noticed such? Maybe it's been happening all along, and it's
            only because I just started relying upon it to identify the domain-name that
            gets connected to. I would like to host 12 domains using one page which uses
            HTTP_HOST to identify which VirtualHost was connected to.
            >
            Thanks for ANY and ALL suggestions, replies, hints, comments.
            >
            Is this the default website for your host? Is it possible they are
            accessing it via the ip address? Even possibly with a script or telnet
            session?

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • JC

              #7
              Re: Undefined index: HTTP_HOST

              "Jerry Stuckle" asked:
              Is this the default website for your host? Is it possible they
              are accessing it via the ip address? Even possibly with a script or
              telnet session?
              Right at the moment it's not occuring all that often, a couple times
              a day at the most, if any.

              The default site is the IP address (the IP address is listed as the
              first VirtualHost and as the ServerName before any VirtualHost).

              Oops, wrong IP address was listed there. Maybe that corrects all.

              Thanks, Jerry.

              --
              JC
              Natural Cure For Pink-Eye (Conjunctivitis )



              Comment

              • birre

                #8
                Re: Undefined index: HTTP_HOST

                (4)
                The HTTP_HOST header gets lost somewhere, sometimes.
                >
                I only recently started using $_SERVER['HTTP_HOST'] and the problems show
                up in the PHP error logs. So far I have not been able to identify where
                it ended up logged in the Apache logs.
                >
                Is there another way to identify which host gets connected to (PHP question)?
                >
                Has anyone else noticed such? Maybe it's been happening all along, and it's
                only because I just started relying upon it to identify the domain-name that
                gets connected to. I would like to host 12 domains using one page which uses
                HTTP_HOST to identify which VirtualHost was connected to.
                >
                Thanks for ANY and ALL suggestions, replies, hints, comments.
                >
                I'm not sure I understand the question, but I tested with:
                echo "HTTP_HOST is " . getenv('HTTP_HO ST') . ":<br>";
                and it seems to work.


                /bb

                Comment

                Working...