Getting an error when starting WAMP - “VirtualHost *:80 — mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results”

Question!

I'm running WAMP v2.0 on WindowsXP and I've got a bunch of virtual hosts setup in the http-vhosts.conf file.

This was working, but in the last week whenever I try & start WAMP I get this error in the event logs:

VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results.

and the server won't start. I can't think of what's changed.

I've copied the conf file below.

NameVirtualHost *
<VirtualHost *:80>
    ServerName dev.blog.slaven.net.au
    ServerAlias dev.blog.slaven.net.au
    ServerAdmin [email protected]
    DocumentRoot "c:/Project Data/OtherProjects/slaven.net.au/blog/" 
    ErrorLog "logs/blog.slaven.localhost-error.log"
    CustomLog "logs/blog.slaven.localhost-access.log" common

    <Directory "c:/Project Data/OtherProjects/slaven.net.au/blog/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
            Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

EDIT: I meant to add, if I change the NameVirtualHosts directive to specify a port, i.e

NameVirtualHost *:80

I get this error:

Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80



Answers

NameVirtualHost *:80

I get this error:

Only one usage of each socket address (protocol/network address/port) is normally >permitted. : make_sock: could not bind to address 0.0.0.0:80

I think this might be because you have somthing else listening to port 80. Do you have any other servers (or for example Skype) running?

(If it was Skype: untick "Tools > Options > Advanced > Connection > Use port 80 and 443 as alternatives for incoming connections")

By : nohj


Well, it seems the problem there is the way (and order) in which you assign the ports.

Basically, *:80 means "use port 80 for all hosts in this configuration". When you do this, Apache tries to bind that host to 0.0.0.0:80, which means that host will receive every single packet coming to the machine through port 80, regardless of what virtual host it was intended to go to. That's something you should use only once, and only if you have one host in that configuration.

Thus, if you have the same *:80 directive on two hosts in the configuration file, the server won't load because it will try to bind 0.0.0.0:80 twice, failing on the second try. (which explains the "Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80" message).



I disagree with Jon Limjap when he says,

It is not a contract on either a.) how the method should be implemented and b.) what that method should be doing exactly (it only guarantees the return type), the two reasons that I glean would be your motive in wanting this kind of test.

There could be many parts of the contract not specified in the return type. A language-agnostic example:

public interface List {

  // adds o and returns the list
  public List add(Object o);

  // removed the first occurrence of o and returns the list
  public List remove(Object o);

}

Your unit tests on LinkedList, ArrayList, CircularlyLinkedList, and all the others should test not only that the lists themselves are returned, but also that they have been properly modified.

There was an earlier question on design-by-contract, which can help point you in the right direction on one way of DRYing up these tests.

If you don't want the overhead of contracts, I recommend test rigs, along the lines of what Spoike recommended:

abstract class BaseListTest {

  abstract public List newListInstance();

  public void testAddToList() {
    // do some adding tests
  }

  public void testRemoveFromList() {
    // do some removing tests
  }

}

class ArrayListTest < BaseListTest {
  List newListInstance() { new ArrayList(); }

  public void arrayListSpecificTest1() {
    // test something about ArrayLists beyond the List requirements
  }
}


This video can help you solving your question :)
By: admin