WordPress.org

Ready to get started?Download WordPress

Forums

WP and Mamp (17 posts)

  1. tmdea
    Member
    Posted 6 months ago #

    Hi, sorry if this has been asked but I cant find it with the exact environment I am running. Its as follows:

    Until now I had been doing WP and MAMP dev on 1 machine alone. No problems there. A friend is now going to be working on the same site as me and So he borught his imac, same as mine, and I bought a server mini so that we can both work off the same directory.

    To move everything from my single user environment to the server where we can coloborate, do I need to upgrade to MAMP Pro? I have tried to run everything with regular mamp and am having some problems. Here is what was done.

    Enabled file sharing and web services on mac server. Installed MAMP free. Moved entire DB folder from single user machine to db folder on server MAMP. Moved working file directory and pointed apache to it. Verfied all DB files tables and actual dbs themselves show up in myphpadmin, everything looks fine including user name et cetera.

    Getting :error establishing a database connection" when I try to enter a website page from the MAMP localhost:8888 index page.

    All my wp cfg files still use root/root "db_name" and localhost for the 4 main DB parameters.

    So 1 how do I fix this and how should I best structure the working dirs. to use this way? Should I put everything in the server OS server webpages library, or create a new webpage. Create a new webpage requires a domain name and wont accept a file path. All kinds of problems with this. Would MAMP Pro just make this a breeze? Thanks in advance.

  2. bemdesign
    Member
    Posted 6 months ago #

    MAMP Pro can do it with some configuring.

    Or you could try out Bitnami (http://bitnami.com/stacks) which provides pre-built stacks for local or server installation.

    Either way, you're going to want to read-up on how to set up, configure, secure and run a server which goes way beyond WordPress support.

  3. tmdea
    Member
    Posted 6 months ago #

    Thanks for the reply. I am giving the stack a try but its a little different than the standard MAMP. For instance there is only the option to start/stop apache and sql as opposed to also setting the working directory which allows you to open localhost for an index of all sites. I suppose this now puts you in the realm of manually editinf conf files to set that kind of thing up?

  4. tmdea
    Member
    Posted 6 months ago #

    I think the Mac Server OS interferes with the Mamp stack. To server pages server has to be on, but once server is on the apache in server takes over the localhost? What is the solution? Virtual hosts?

  5. bemdesign
    Member
    Posted 6 months ago #

    Wait, if you're running Mac OS X Server, why bother with MAMP or Bitnami? Just install MySQL and work with the already existing Apache and PHP that comes pre-installed with Mac OS X.

    If you plan on serving more than one site off of the server, yes, you will need to work with Virtual Hosts. The other key bit is port forwarding and configuring your router.

    Like I said earlier, this is moving way beyond WordPress support and is more about server configuration and management. I'd suggest hitting up an appropriate forum for this kind of information.

  6. tmdea
    Member
    Posted 6 months ago #

    OK, I appreciate the feedback. The idea was that the other user is very tech green and needed the most simple implementation possible therefore MAMP+Wordpress.

  7. tmdea
    Member
    Posted 6 months ago #

    Wait, I'd like to clear 1 thing up. I don't want to host any sites. This is purely for local collaboration during development.

  8. bemdesign
    Member
    Posted 6 months ago #

    Ah... Okay. Then MAMP pro should do everything you need but you'll still need some "extra" configuration to be able to access the sites over the local network (MAMP pro can handle the virtual hosts). See http://madebyraygun.com/blog/2012/connecting-to-mamp-sites-from-other-local-network-clients/ for a possible solution.

  9. tmdea
    Member
    Posted 6 months ago #

    I had actually come across that blog but didn't like the need for the proxy. This just seemed to me like it could work very simply. I am very close to having this work now with the following set up.

    Install Mamp on all computers, 2 imacs and 1 server.
    Put all files on server and share
    Map MAMP apache to the same share folder on server

    Opening each site's wordpress will allow me to edit them from each computer in collaboration form. The trouble comes in when the MySQL is not shared. Each imac has its own MySQL and unlike the apache files, I don't think the DB can be shared in the way a file is shared? I would have to replace the "db" folder with a link to a network shortcut named "db" but I don't think that would work.
    Another problem point is there are links being generated by WP with the "localhost/" in the file path. These links break when viewed remotely via a browser pointing to the server IP.

    I don't even really need virtual hosts for each site. It is fine if I can get just an index page with a list of all the sites by going to the server IP address.

  10. bemdesign
    Member
    Posted 6 months ago #

    Huh. I think your solution overcomplicates the matter though. You don't need three servers (which is what MAMP is). You need one central server that two development machines have access to the htdocs folder to edit files on, no?

  11. tmdea
    Member
    Posted 6 months ago #

    That is correct.

  12. tmdea
    Member
    Posted 6 months ago #

    So with 1 MAMP running, how do the MYSQL files get worked on, all via the WP admin for each site only?

  13. tmdea
    Member
    Posted 6 months ago #

    Here is an example of why I couldnt get it to work with the 1 MAMP on the server setup. If I open the index list and go to a site, the images are gone, and when I check the image link it is something like this:

    http://localhost/MyWebsite/wp-content/themes/MyWebsite/images/logo-alt.png

    So is WP grabbing some kind of improperly set variable that resolves to "localhost" ? How do I fix this one thing? If I can do that then I think everything will work as I need it to,

    Thanks again.

  14. bemdesign
    Member
    Posted 6 months ago #

    Did you configure the WordPress install correctly? So the site url should be (based on the image path you provided):

    http://localhost/MyWebsite/

    if that's correct, the image paths should be fine. That being said, this URL is not accessible to other devices until you edit the hosts file on those devices to map the address to that server IP/folder.

    So it's a bit like configuring virtual hosts but on each machine that wants to connect to this server and see these sites. Look into GasMask, a free hosts file editing and management app. At least I think that's what you'll need to do.

  15. tmdea
    Member
    Posted 6 months ago #

    I think you are right. I didnt even think of adding localhost in the hosts file to point to the server as clearly that is bad practice in general. But I think in this case it would be a harmless workaround. I appreciate the responses.

  16. bemdesign
    Member
    Posted 6 months ago #

    Take a look at Gas Mask - it's a small lightweight app for managing a Mac's hosts file. Like it can save completely new versions of a hosts file and you can select which version you want to use, thus preserving the original hosts file. Do note you may have to flush your DNS cache after changing hosts files for it to take effect.

  17. tmdea
    Member
    Posted 6 months ago #

    OK I was able to sort this all out. Thanks for the all the help.
    In the end I was running into different problems on different computers. On the Server OS machine, the root problem ended up being that Apache is set to auto start, even if you turn off the Web Services in the Server control panel. This wasted several hours for me. I ended up having to issue a sudo shutdown command and then MAMP is able to run on port 80 there now. I had to run on 80 so that the images set with localhost in the path would actually open. On 8888 they would break. So once that was taken care of, I edited the hosts file on the 2 workstations to resolve localhost to the server IP. I dont love this idea but for now it works and im sure at some point I will figure out how to remove the localhost name from the files and can go back to standard hosts files.

    Gas mask seems useful for other ideas but I wont use it for this because I would rather work with a standard localhost resolution once I fix the paths.

Reply

You must log in to post.

About this Topic

Tags

No tags yet.