Viewing 7 replies - 1 through 7 (of 7 total)
    1. ‘localhost’ always means ‘this computer’. ‘localhost’ is a reference to ‘self’. So if you browse to localhost the software looks for a webserver running on whatever computer is doing the browsing. If you happen to be browsing from the Mac that has MAMP installed, everything works. If you browse from some other computer it doesn’t. I mention this mostly because your headline made me think about it. You’ll never be able to connect to your MAMP server using ‘localhost’ except from the Mac that has MAMP installed.
    2. There is a difference between a filesystem path and an URL, and it looks to me that you have them jumbled though I admit to some confusion as explained below. The filesystem path is used by the system software and looks like this: /Library/WebServer/Documents/mysite/public_html/blog/. Web servers are told where to look in a filesystem path to find the documents to serve but access to those documents via the http protocol does not use the filesystem path but an URL which is the server’s name/IP prepended to the filesystem path starting at wherever the server’s documents are (but with URL rewriting, includes, redirecting… even this gets wonky). In your case, the server looks for its documents in /Library/WebServer/Documents/mysite/public_html/— I’m guessing having never ran MAMP but that ‘public_html’ bit is common enough. That is where the server’s path starts, meaning that access to those documents is at https://localhost:8888/ not at https://localhost:8888/mysite/public_html/.
    3. That leads me to the confusion mentioned above. I don’t understand why you can login to the WP backend at https://localhost:8888/ but also view the site at https://localhost/mysite/public_html/. If you installed in your document root, you should be viewing the site at https://localhost:8888/ and logging in at https://localhost:8888/wp-admin. If you installed in ‘blog’, you should be viewing the site at https://localhost:8888/blog/ and logging in at https://localhost:8888/blog/wp-admin/.
    4. Also, MAMP by default installs the server to port 8888, most software looks to post 80 for http connections so that ‘:8888’ is important. Its also further confusing that things somewhat work with or without the ‘:8888’.

    Hang on…Macs have Apache installed by default. If that default server is enabled you might be serving the files from two different web servers on two different ports, which could explain some of my confusion. Apple’s controls for the default Apache server are under ‘Sharing’ so look in your Sharing control panel and see if ‘Personal Web Sharing’ is turned on. The default instance of Apache serves files from (in Apple’s pseudo-filepath nomenclature) /Users/<username>/Sites.

    Well… maybe not as helpful as I’d hoped…

    On OS X, the usual localhost URL is https://localhost/~shortloginname/public_html/
    which points to harddrive/Users/shortloginname/Sites/public_html/ and for your install, that’s harddrive/Users/shortloginname/Sites/public_html/blog/

    In your wp-config.php, you should have localhost, or try localhost:8888, which may fix the database connection error.

    And as apljdi says, turn on Personal Web Sharing in your Pref Panes.

    And as apljdi says, turn on Personal Web Sharing in your Pref Panes.

    Actually, that’s not what I meant, though I may be thinking wrongly. jamestoc is using MAMP so you’d want the default server turned off, correct? Or does MAMP somehow highjack that server and bend it to its will?

    From my experience, MAMP doesn’t hijack the default server. But, I haven’t used MAMP much; I use the standard apache/mysql default install on OS X, kind of rolled-my-own.

    It’s confusing to me as the database connection error only happens on that one URL. Unless somehow there are two databases? jamestoc should check his database with phpmyadmin and see if there are two sets of tables for wordpress.

    Here’s a good tutorial for MAMP: Installing WordPress Locally Using MAMP.

    Thread Starter jamestoc

    (@jamestoc)

    ThankYouThankYouThankYou apljdi and songdogtech for your helpful thoughts – I didn’t have that particular MAMP tutorial. MAMP sneaks in separately from whatever else you already have installed and leaves it untouched. I’ve probably managed to cross-wire it through misunderstanding. Much for me to check out now – will be back

    I use the standard apache/mysql default install on OS X, kind of rolled-my-own.

    I tried this once and almost shot myself and everyone in the office too, not in that order. ?? I’ve installed Apache/PHP/MySQL from source on several different Slackware boxes just fine but something about OS X threw me. If I ever try that again you’ll be hearing from me and I hope I’ll hear back.

    Thread Starter jamestoc

    (@jamestoc)

    Up to this time I have never put my local test sites in /Users/myname/Sites, but always in /Library/WebServer/Documents – I can’t remember exactly what advice I was following when I did this (something to do with TYPO3, I think!) But I do have Web Sharing “On” anyway. My localhost sites are visitable on urls in the form https://localhost/sitename/htdocs(or public_html or whatever)/, and they work with the installation of PHP and MySQL which came with OS X 10.5 – don’t ask how I achieved that! I never heard about MAMP until looking at WordPress and it seemed easier to go that way. I had forgotten that I had set the existing MySQL to start up on start-up and it had not occurred to me to stop it before trying this MAMP/WordPress stuff. I have done that now, but I don’t think it makes any difference, because the whole MAMP thing really does seem to be separate and self-contained, but I’ll keep watching that anyway
    After reading the last part of the tutorial which songdogtech mentioned here, which says: “1. Can I use MAMP to host my web site for other people to see? – Yes, but not really. MAMP is more like a testing ground to run server scripts on your local computer. … ” I decided to start again and install exactly as per the default description, that is, the WordPress files in /Applications/MAMP/htdocs/wordpress and configuring ‘DB_HOST’ as ‘localhost:8889’ (instead of just ‘localhost’ – but this doesn’t make any difference), so I could simply concentrate on learning how to work with WordPress. Everything works out as described except that where the tutorial ends saying ” … Everything you run in MAMP should start https://localhost:8888/ this is sort of like www, then you’ll add the name of the folder you are trying to access in the htdocs folder. So it will be https://localhost:8888/wordpress. Everything you add after that will take you to a different file in the wordpress folder.”, what happens for me is:
    https://localhost:8888/wordpress/ = should go to the WP blog page, but gets a 404 “Not Found”?https://localhost:8888/ = successfully gets the WP blog page?https://localhost/wordpress/ = gets “Error connecting to database” – this was my original problem and is happening I guess, because it’s trying look at my other MySQL instance
    When I’ve sorted out what I want do WordPress-wise locally, it’ll be a whole different ball-game getting the real site instances working, wherever they are, so I wont start worrying about that now until I get to that. Meanwhile, thanks again for your help – if I’m ever able to return the favour, I’ll be only too happy to

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘MAMP blog viewable by admin at https://localhost:8888/ but not by site visitors’ is closed to new replies.