SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict
    Join Date
    Dec 2002
    Location
    Philadelphia
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Localhost not working?

    I am a complete newbie to PHP but not new to programming.

    I set up PHPTriad yesterday, and ran it, and started writing PHP scripts and looking at them via http://localhost/documentname.php on my local machine
    (Windows XP).

    Everything was fine.

    Then, a few hours later, suddenly very weird things began to happen. Mainly, I couln't access any new or revised php pages in my local browser anymore. For example, when I try to access
    http://localhost/sun.php I get an error saying that the page cannot be viewed offline.

    What was even more weird was that, after deleting a page named first.php, I could still access it at a location where it no longer existed. It's almost as if it's frozen in some sort of cache or something.



    I checked the processes running in the Task Manager, and I see a few instances of Apache, and a few of mysqld-nt.exe. I tried restarting my machine and the same thing happens. Also, I cannot access any of the links on the control panel for PHPTriad...I get the same message--> "This page cannot be viewed offline".

    It seems that there would be a simple answer to all of this...what's going on?

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds like a browser configuration issue. Have you tried changing your connection settings or tried another browser?

    Aaron
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Addict
    Join Date
    Dec 2002
    Location
    Philadelphia
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I try http://localhost in Netscape, it won't even let me enter anything while I am "offline". When I am online, it looks for this address on the web, to no avail , of course.

    What is really weird is that it was working fine in Internet Explorer for a few hours, then it stopped working, without any reboots or other users visiting the computer. It was handling the php section of the codes, because I had "echo" commands inside of html that were outputting strings to the screen.

    I hadn't changed browser config settings, but I looked for changes to make and couldn't find any that related to php or anything that seemed like it would make a difference. And I also wondered why it would be finding a php page that didn't exist anymore.


    nj
    Last edited by Shem; Dec 16, 2002 at 00:12.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2002
    Location
    Israel
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mmm...

    as Sketch wrote according to the description u wrote here it does sounds like a browser configuration problem. first of all try to load on u'r browesr the localhost, and when it gives u the msg of 'cannot load this page offline' there should be a button calld connect or something of that sort. click it. check to see what happens, then try to go on u'r explorer to the file menu and there, click on the "work offline" which most probably has a check mark next to it, so basically what u need to do is to uncheck it.
    then try to reload the page, by clicking the reload button. after all that, whether it worked or not go to the tools menu and there, delete all the temprary internet file (inculding those of the offline content).
    if all that wont work, try, instead of localhost, type in 127.0.0.1
    which is actully the same as localhost, and see if that works.
    all that, assumming there is no problem with the apache configuration. the fact that the process is alive in the task maneger, doesnt say that the apache itself is on... it could be on stop, or it could have some kind of probleam that wont allow it to run. check the apache icon u have near the XP clock, it should be with the sigh of "play" (a ractangular pointing to the right). make sure it on "play" and not on hold or on stop.

    best of luck
    shanor.
    You can't see your self in the mirror with your eyes closed!

  5. #5
    SitePoint Addict
    Join Date
    Dec 2002
    Location
    Philadelphia
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had tried all of the above, except cleaning out the cache as you mentioned. After cleaning out the cache now it works again.

    Thanks!

    nj

  6. #6
    SitePoint Wizard xyuri's Avatar
    Join Date
    Jul 2002
    Location
    Brisbane
    Posts
    1,487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    grrr, thats exactly what i thought the problem was whilst reading Shem's original post

    Shem, try setting your browser so that it updates documents every time, or if you want it the way it is then put a tag at the top of your web documents that prevents it from being cached

    like:
    PHP Code:
    <?PHP
    // Prevent page cacheing
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
    header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT"); // always modified
    header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
    header("Cache-Control: post-check=0, pre-check=0"false);
    header("Pragma: no-cache"); // HTTP/1.0
    ?>

  7. #7
    SitePoint Addict
    Join Date
    Dec 2002
    Location
    Philadelphia
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I guess I didn't realize that PHP pages would be cached also.

    I like that PHP header() function you showed.

    Which reminds me, I usually use
    <meta http-equiv="expires" content="now">
    in HTML docs for a no cache, but recently I heard that this was not as good as other tags. What is your experience with this? It seems to work for me but I do not test in a whole lot of browsers.

  8. #8
    SitePoint Wizard xyuri's Avatar
    Join Date
    Jul 2002
    Location
    Brisbane
    Posts
    1,487
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, I'm go guru

    I got that code from somewhere on these forums while back. its bacically the same bit of code but for different HTTP versions and browsers. You shouldnt need it though, you should optimise the settings of your browser as it is the wise and better thing to do


Bookmarks

Posting Permissions

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