SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    simpletest web tests not running on Vista?

    Hi guys,

    I'm having trouble running web tests with Simpletest in Windows Vista, specifically using WebTestCase::get() to retrieve a local url.

    The following code:

    PHP Code:
    class SomeWebTestCase extends WebTestCase() {
       function 
    testSomething() {
           
    $this->get('http://localhost/test');
       }

    Fails with the following error: "Error reading socket [Cannot open [localhost:80] with [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ] within [15] seconds]"

    If I use a remote url, e.g.

    PHP Code:
    class SomeWebTestCase extends WebTestCase() {
       function 
    testSomething() {
           
    $this->get('http://www.sitepoint.com');
       }

    Then all is well, if I use showSource() I get the source of the remote page and everything.

    If I point my web browser to http://localhost/test then it loads the page just fine so I presume there's nothing wrong with the local webserver.

    In addition, I have just run the exact same code with the exact same webserver configuration (Wampserver in both cases) on a Windows XP machine and it works fine for local and remote urls. I've never had a problem before using web test cases and fortunately I do have a WinXP machine available as well to run these on, but it's a bit annoying all the same.

    Obviously this is an issue with Vista since there's no problem with Win XP - but does anyone know how to fix this?

    Incidentally fakemail (the python version which needs to be tweaked to work on windows) is also problematic to run on Vista. I tested the installation with telnet (which I had to download for Vista!!) and it's fine, but I can't get the PHP scripts to send emails. Again, on Win XP there is no problem at all.

    Any help is appreciated!!

  2. #2
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try replacing localhost with 127.0.0.1

  3. #3
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    348
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kyber, would you know I actually thought to do that as soon as I posted the thread - it works!

    Does Vista not map localhost to 127.0.0.1 ?

  4. #4
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't remember the exact reason, but I remember having problems with that before (It's not particular to Vista - it's a Windows issue). I think you can just go to the hostfile (C:Windows\system32\drivers\etc\hosts) and put an entry that points localhost to 127.0.0.1.

  5. #5
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    By default Windows Vista is a native IPv6 system, but as with most things IPv6 is not fully adopted. localhost points to ::1 (IPv6 equivalent of 127.0.0.1) in the host file versus 127.0.0.1 for IPv4.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



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
  •