« Previous Next »

Thread: PHP SERVER("HTTP_HOST") is not working

Last post 06-29-2009 8:50 PM by brashquido. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 06-28-2009, 11:58 PM

    • kakadia
    • Not Ranked
    • Joined on 06-29-2009, 3:30 AM
    • NJ
    • Posts 8

    PHP SERVER("HTTP_HOST") is not working

    Mys system info : Server 2008 SP2 IIS7.0

    PHP Version Installed : 5.2.10

    The PHP is installed through Web Platform Installer 2.0

    I'm currently hosting a site in my server...and i'm trying to use this code in website...but the code is not excuting...means the server host name is not displaying..

     THE CODE IS:

    <? echo $_SERVER['HTTP_HOST']; ?>

    Please let me know if any PHP configuration take place to resolve this problem.

     

  • 06-29-2009, 5:53 AM In reply to

    Re: PHP SERVER("HTTP_HOST") is not working

    You need to turn short tags on in php.ini or change your code to;

     <?php echo $_SERVER['HTTP_HOST']; ?>

     I know the web platform installer makes it easy, however the downfall with that is you don't learn anything about how it all hangs together in the back end. I would recommend you do at least some reading on PHP if you are looking to use it extensively on your server.

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 06-29-2009, 12:45 PM In reply to

    • kakadia
    • Not Ranked
    • Joined on 06-29-2009, 3:30 AM
    • NJ
    • Posts 8

    Re: PHP SERVER("HTTP_HOST") is not working

    thank you so much...it's finally working..

    but the iis virtual directory,

     404 File or Folder not found error occured....

     any clues on this...i tried to enable virtual directory in php.ini but i can't find nothing about.it.

     

  • 06-29-2009, 8:50 PM In reply to

    Re: PHP SERVER("HTTP_HOST") is not working

    A 404 error on a virtual directory is going to most likely be a permissions issue. Make sure your IIS user account has at least read NTFS permissions to the contents of your virtual directory.

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
Page 1 of 1 (4 items)