WordPress.org

Ready to get started?Download WordPress

Forums

need help making it public (16 posts)

  1. Rakeki
    Member
    Posted 4 years ago #

    Hey im having problems with allowing people on my LAN line to connect and use my blog, i have changed the WordPress address (URL) and Blog address (URL) to my LAN ip address, at first i thought it worked but then when the user tryed to log in, it tryed connecting to localhost, because the mysql wasnt on their computer it wouldnt display, how can i get the user to connect to my pc's (LAN) when going through the login stage.

  2. s_ha_dum
    Member
    Posted 4 years ago #

    Try using the IP address of your MySQL server-- 192.168.?.? (probably)-- instead of the localhost alias.

  3. Rakeki
    Member
    Posted 4 years ago #

    im triyng to find where i do that =/

  4. Mark / t31os
    Moderator
    Posted 4 years ago #

    Set the local IP as the blog URL/WP url..

    ie. the 2 settings that currently say..
    http://localhost
    should read..
    http://192.168.1.1

    Purely an example, just be sure to set your PC to a static IP (any decent router allows IP reservation, no PC config required), otherwise you'll be forever changing the URL to match your IP..

    Good chance your PC/Mac uses DHCP to get a dynamic local IP, for example within a range of 192.168.1.2 > 192.168.1.255 , if that changes, you'll have to update your WP install each time with the new IP. Mac, PC whatever, there's plenty of guides on how to set a static local IP.

  5. Rakeki
    Member
    Posted 4 years ago #

    ive done that =/ and i said ive done that with my first post >.<

  6. s_ha_dum
    Member
    Posted 4 years ago #

    Change the setting in your wp-config.php file. Instead of define('DB_HOST', 'localhost'); put define('DB_HOST', 192.168.?.?);

    This part of t3los_'s post you did not say you did-- 'just be sure to set your PC to a static IP'. Good idea.

  7. Mark / t31os
    Moderator
    Posted 4 years ago #

    I use my lan IP for my local installation, the thing that caught me out was the IP problem, most routers give these via DHCP, which means it changes each time you refresh the connection, reconnect, reboot, or whatever...

    Please realise i'm not talking about the IP your router gets (your ISP IP address), incase there was any confusion, but the internal local IPs (ie. the IP addresses the router assigns to the PCs on the local network).

  8. Rakeki
    Member
    Posted 4 years ago #

    okay when i change it to ('DB_HOST', 'localhost'); put define('DB_HOST', 192.168.?.?); i cannot connect to the wordpress myself

  9. Rakeki
    Member
    Posted 4 years ago #

    i know all about DHCP lol and you can disable this feature

  10. Mark / t31os
    Moderator
    Posted 4 years ago #

    Well i can't see what the issue is, all i've done to get it working here is change the blog/web URL to my local IP, and all local PCs are able to view the page.

    Does anything come up at all for the other PCs when connecting to the IP, or does it just timeout / page not found?

  11. s_ha_dum
    Member
    Posted 4 years ago #

    okay when i change it to ('DB_HOST', 'localhost'); put define('DB_HOST', 192.168.?.?);

    No. You are supposed to substitute the one for the other.

    Replace:

    define('DB_HOST', 'localhost');

    With:

    define('DB_HOST', 192.168.?.?);

    Of course, you need to substitute your actual IP address. I don't know that this will help though, honestly. I connect to my development installs from half a dozen computers inside the LAN and I use 'localhost' in the wp-config. I only suggested it because your first post implied that MySQL was trying to connect to the wrong machine(s).

    Do you have a screen shot of the login error?

    Also:

    i know all about DHCP lol and you can disable this feature

    So this means that your server does have a static IP right?

  12. Mark / t31os
    Moderator
    Posted 4 years ago #

    @ apljdi
    How do your lan PC's see the page if it's using localhost, localhost will resolve to the PC you're viewing on will it not? You'll see the page, but any stylesheet links etc, should point to invalid locations..

  13. s_ha_dum
    Member
    Posted 4 years ago #

    @ t3los_
    It is PHP that is connecting to MySQL, not the browser, and PHP runs on the server, and since PHP and MySQL are on the same machine (at least right now) using localhost as my DB_HOST in wp-config.php works fine. My 'home' and 'siteurl' are set to the server's static IP, of course, for the reasons you mention.

  14. Mark / t31os
    Moderator
    Posted 4 years ago #

    Oh right, my bad, i didn't realise you were referring to the wp-config line, i was thinking you meant the blog url settings etc... which had me confused..

    Pretty sure we're both successfully doing what the original poster is asking about then, except we seem to have a bit more luck... :)

  15. Rakeki
    Member
    Posted 4 years ago #

    yes i have a static LAN address when i use my LAN for the website it works fine... but as soon as somebody on my LAN connects to the website and logs in it attemps to connect to the MYSQL on their computer i know this because the URL box stated "localhost" before timing out and reciving a database error

  16. Mark / t31os
    Moderator
    Posted 4 years ago #

    You know, i never login when accessing from another PC, so i thought i'd better confirm if it works..

    Logged in from another PC under a test account. Sitting look at the administration panel right now. I know that's not what you wanted to hear, but for the sake of verfiying it works..

    Can you paste the error in it's entirety here please?

Topic Closed

This topic has been closed to new replies.

About this Topic