The MU forums have moved to WordPress.org

WPMU only works without the port number in the URL. (20 posts)

  1. Hanhart
    Member
    Posted 4 years ago #

    Hello,

    I looked for a solution on the forums, but I could not find anything that really helps me any further.

    I have my own server using MAMP. I am using Mac Os 10.5.8.

    I want to start using BuddyPress, but I need to install WordPress MU first.

    When Installing it, I do the following :

    DATABASE

    DB Name : wordpress
    Username : my username
    Password : my password
    DB Host : localhost

    SERVER ADDRESS

    Server Address : localhost:8888

    When I click submit, i get this error : WPMU only works without the port number in the URL.

    If i understand correctly, I need to change the Server Address, but I have no clue what I need to change it to.
    I am sort of new to all this, so it would be great if somebody could help me.

    Thanks! (And sorry for the bad English)

  2. SteveAtty
    Member
    Posted 4 years ago #

    WPMU expects to be sitting on the default Apache port (80) and so none of the url handling has been written to support it containing a hard coded port in the URL.

    If you've installed MAMP then it should be listening on port 80 so just try running your install with no hard coded port in the URL.

  3. tdjcbe
    Member
    Posted 4 years ago #

    Running out the door. Someone point out the usage of localhost as well please.

  4. SteveAtty
    Member
    Posted 4 years ago #

    I didn't even see that, I was too busy thinking about lunch.

  5. petitlaf
    Member
    Posted 4 years ago #

    Running out the door. Someone point out the usage of localhost as well please.

    Hi! I'm having the same problem, are you implying that it is impossible to install wordpress mu using MAMP on localhost? If not, could you eleborate on the modifications I need to implement to install wordpress mu properly?

    Thank you for your help.

  6. tim.moore
    Member
    Posted 4 years ago #

    Wordpress expects a full url, like example.com as the server address. If you try to set the server address as just localhost you'll be creating a whole slew of problems for yourself.

    You need to at least set the server address as localhost.localdomain.

  7. petitlaf
    Member
    Posted 4 years ago #

    I appreciate your answer, but how do I change the localhost name?

    I searched online and all I could find were forum threads recommending using Netinfo or changing the hostname in the etc/hostconfig file, both solutions not feasible (my computer doesn't have Netinfo in its utilities and hostconfig doesn't have an 'hostname' line).

    I tried using VirtualHostX, but then I would get 'Database not accessible' errors, is there a simple way to change the localhost name?

    Thank you for your help.

  8. SteveAtty
    Member
    Posted 4 years ago #

    /etc/hosts should contain something like 127.0.0.1 localhost

    That's the line you need to change by adding localhost.localdomain on the end of it.

    Also unless you edit the hosts file for each new blog you can't really install in subdomain mode.

  9. seb_m
    Member
    Posted 4 years ago #

    Running a locally hosted installation of WPMU on MAMP is not too difficult. You have to configure MAMP to use the default ports - there is a button in the preferences area that will do this for you automatically. Next, you have to find out your computer's network name, which (I think) can be found in System Preferences -> Sharing. My computer is called "artist3" for some reason, so I access my local WPMU at artist3.local/wpmu.

    Hope that helps!

  10. petitlaf
    Member
    Posted 4 years ago #

    Thank you both for your answers. I didn't know I could simply use my computer's network name. Everything is finally working.

  11. Andre81
    Member
    Posted 4 years ago #

    Hi @ All,

    I'm running a WAMP Server (Windows Apache MySQL php) and I have the necessity to run apache server on port 8080.

    When installing WPMU I get the follow error: "WPMU only works without the port number in the URL."

    Thanks

    Andrea

  12. charlie_hun
    Member
    Posted 4 years ago #

    @Andre81: WordPress MU works only http or https port.

  13. itguy51
    Member
    Posted 4 years ago #

    Hey... Try editing lines 8-20. The PORTS are hard coded.

  14. kalengi
    Member
    Posted 4 years ago #

    @itguy51 - The port numbers appearing there are only being used to check whether they were supplied in the url. If they are found, they are stripped out. This means even if you edit the code to insert your custom port number, it shall be stripped out therefore rendering the url invalid.

    What I've done is:
    1. Comment out the url-checking code. Find this code:

    <br />
    $domain = addslashes( $_SERVER['HTTP_HOST'] );<br />
    if( substr( $domain, 0, 4 ) == 'www.' )<br />
    	$domain = substr( $domain, 4 );<br />
    if( strpos( $domain, ':' ) ) {<br />
    	if( substr( $domain, -3 ) == ':80' ) {<br />
    		$domain = substr( $domain, 0, -3 );<br />
    		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );<br />
    	} elseif( substr( $domain, -4 ) == ':443' ) {<br />
    		$domain = substr( $domain, 0, -4 );<br />
    		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );<br />
    	} else {<br />
    		die( 'WPMU only works without the port number in the URL.' );<br />
    	}<br />
    }<br />
    $domain = preg_replace('/:.*$/', '', $domain); // Strip ports<br />
    if( substr( $domain, -1 ) == '.' )<br />
    	$domain = substr( $domain, 0, -1 );<br />

    and comment it like so:

    <br />
    /*<br />
    $domain = addslashes( $_SERVER['HTTP_HOST'] );<br />
    if( substr( $domain, 0, 4 ) == 'www.' )<br />
    	$domain = substr( $domain, 4 );<br />
    if( strpos( $domain, ':' ) ) {<br />
    	if( substr( $domain, -3 ) == ':80' ) {<br />
    		$domain = substr( $domain, 0, -3 );<br />
    		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );<br />
    	} elseif( substr( $domain, -4 ) == ':443' ) {<br />
    		$domain = substr( $domain, 0, -4 );<br />
    		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );<br />
    	} else {<br />
    		die( 'WPMU only works without the port number in the URL.' );<br />
    	}<br />
    }<br />
    $domain = preg_replace('/:.*$/', '', $domain); // Strip ports<br />
    if( substr( $domain, -1 ) == '.' )<br />
    	$domain = substr( $domain, 0, -1 );<br />
    */<br />

    2. Set up the domain and $_SERVER['HTTP_HOST'] variables with the custom port. Just after the commented code, insert:

    <br />
    $domain = 'kalengi.localhost:8040';<br />
    $_SERVER['HTTP_HOST'] = 'kalengi.localhost:8040';</p>
    <p>

    Replace <b>kalengi.localhost:8040</b> with your own local domain and port.

    After this this home page loaded. I suspect that there is going to be some trouble down the road since WPMU expects no port number, but in my case I have to use the port number so I'll just sort out the issues as they arise. In any case, this is a local test site so I don't mind editing core files.

  15. kalengi
    Member
    Posted 4 years ago #

    Sorry, the code got messed up. It's supposed to be:

    1. Comment out the url-checking code. Find this code:

    $domain = addslashes( $_SERVER['HTTP_HOST'] );
    if( substr( $domain, 0, 4 ) == 'www.' )
    	$domain = substr( $domain, 4 );
    if( strpos( $domain, ':' ) ) {
    	if( substr( $domain, -3 ) == ':80' ) {
    		$domain = substr( $domain, 0, -3 );
    		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
    	} elseif( substr( $domain, -4 ) == ':443' ) {
    		$domain = substr( $domain, 0, -4 );
    		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
    	} else {
    		die( 'WPMU only works without the port number in the URL.' );
    	}
    }
    $domain = preg_replace('/:.*$/', '', $domain); // Strip ports
    if( substr( $domain, -1 ) == '.' )
    	$domain = substr( $domain, 0, -1 );

    and comment it like so:

    /*
    $domain = addslashes( $_SERVER['HTTP_HOST'] );
    if( substr( $domain, 0, 4 ) == 'www.' )
    	$domain = substr( $domain, 4 );
    if( strpos( $domain, ':' ) ) {
    	if( substr( $domain, -3 ) == ':80' ) {
    		$domain = substr( $domain, 0, -3 );
    		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
    	} elseif( substr( $domain, -4 ) == ':443' ) {
    		$domain = substr( $domain, 0, -4 );
    		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
    	} else {
    		die( 'WPMU only works without the port number in the URL.' );
    	}
    }
    $domain = preg_replace('/:.*$/', '', $domain); // Strip ports
    if( substr( $domain, -1 ) == '.' )
    	$domain = substr( $domain, 0, -1 );
    */

    2. Set up the domain and $_SERVER['HTTP_HOST'] variables with the custom port. Just after the commented code, insert:

    $domain = 'kalengi.localhost:8040';
    $_SERVER['HTTP_HOST'] = 'kalengi.localhost:8040';

    Replace kalengi.localhost:8040 with your own local domain and port.

  16. gazouteast
    Member
    Posted 4 years ago #

    Great stuff kalengi

    .... but which file is that in?

  17. steveplatz
    Member
    Posted 4 years ago #

    My computer is called "artist3" for some reason, so I access my local WPMU at artist3.local/wpmu.

    Does that mean that your WPMU installation is in your /Sites/ directory? That makes sense; but what about using MAMP? WIth my files still in MAMP/htdocs/, I get redirected back to the default MAMP port (8888) when I try to access port 80.

    So, h7.local/WPMU/ (my local address) will redirect to localhost:8888/WPMU/, even after switching the MAMP preferences to use the default Apache an d MySQL ports.

  18. steveplatz
    Member
    Posted 4 years ago #

    OK, figured it out: wpmu installed in MAMP/htdocs, MAMP prefs set to default Apache port 80, mynetworkaddress.local/wpmu works as it should.

  19. bjennings
    Member
    Posted 4 years ago #

    @steveplatz - could you clarify how you figured it out? - for me I am still being redirected to localhost:8888/wpmu :-(

  20. bjennings
    Member
    Posted 4 years ago #

    Ok, I just reinstalled wpmu, which sorted everything out!

About this Topic

  • Started 4 years ago by Hanhart
  • Latest reply from bjennings