Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    3

    Unanswered: php scripts only work on localhost

    I am running apache 2, php 4.3, and mysql 4.1 on windows XP. I have noticed that when I view my php pages via locahost (http://localhost/hockey_list/initial.php) they display just fine, but when I view them using my machines domain name (http://squelch.tzo.com/hockey_list/initial.php) the page flashes for a brief moment and then, as if redirecting, brings me to the "Page cannot be displayed" IE error page.

    This has only been happenning for the past few days. I reinstalled apache, php, and mysql to no avail.

    Even if the script is as simple as the phpinfo script which just has
    <? phpinfo(); ?>
    in it, it won't work.

    I guess this would suggest some sort of apache config problem? but I didn't change anything in apache recently so I am puzzled.

    Incidentally, my domain name isn't quite 'real' as it is a tzo.com forward (my machine is behind a cable modem and therefore has dynamic IP which Tzo's service gets around).

  2. #2
    Join Date
    Oct 2003
    Location
    Slovakia
    Posts
    482

    Re: php scripts only work on localhost

    Originally posted by kirilisa
    I am running apache 2, php 4.3, and mysql 4.1 on windows XP. I have noticed that when I view my php pages via locahost (http://localhost/hockey_list/initial.php) they display just fine, but when I view them using my machines domain name (http://squelch.tzo.com/hockey_list/initial.php) the page flashes for a brief moment and then, as if redirecting, brings me to the "Page cannot be displayed" IE error page.

    This has only been happenning for the past few days. I reinstalled apache, php, and mysql to no avail.

    Even if the script is as simple as the phpinfo script which just has
    <? phpinfo(); ?>
    in it, it won't work.

    I guess this would suggest some sort of apache config problem? but I didn't change anything in apache recently so I am puzzled.

    Incidentally, my domain name isn't quite 'real' as it is a tzo.com forward (my machine is behind a cable modem and therefore has dynamic IP which Tzo's service gets around).
    Few questions:

    1. Do you have Virtualhost entry in your httpd.conf?
    2. Do you have domain name entry in your c:\winnt\system32\drivers\etc\hosts?

    for example:

    squelch.tzo.com 192.168.13.10

    3. Or if you are using DNS, is there (in DNS) entry for that domain name?

  3. #3
    Join Date
    Mar 2004
    Posts
    3
    No, I didn't have any of those things.

    I looked in the hosts file and saw that it has only
    127.0.0.1 localhost

    so I added
    192.168.2.50 squelch.tzo.com

    I suppose I can't say also
    127.0.0.1 squelch.tzo.com? One IP can't have two different names?

    My thinking being if I change the backend IP address then I'll have to manually change it in hosts as well...

    I added
    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName squelch.tzo.com
    ServerAlias squelch.us *.squelch.us
    DocumentRoot C:/www/Apache2/htdocs/
    </VirtualHost>

    to my httpd.conf file -- does that look right?

    My script is viewing fine right now but as it is also viewing fine when I take away the stuff in hosts and httpd.conf, I don't know whether it is actually fixed or whether it is just being intermittant again...

    Thanks!

  4. #4
    Join Date
    Aug 2004
    Posts
    1

    php having problem with Virtual Host

    Please help. This is really strange. Apache and php. phpinfo() seem to work fine in localhost. But when it's on Virtualhost it doesn't seem to work. It only work for other browser like firefox mozilla.

    http://localhost/phpinfo.php
    Under IE this work. But

    ================================================== ====
    Nothing loads up if it does only for a moment.
    http://flashzero.homeip.net/phpinfo.php

    <VirtualHost *>
    ServerName flashzero.homeip.net
    DocumentRoot "c:/websites/flashzero/"
    </VirtualHost>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •