I'm putting together a multi-site MAMP installation of Drupal 7.
I created a folder to hold Drupal, and put the Drupal files in there. Moving them out of the downloaded Drupal folder into my "websites" folder (including 2 invisible files)
With the MAMP application, I reset apache to look at this "websites" folder instead of the htdocs folder inside of the MAMP application folder.
In the "sites" folder (drupal files), I put 3 folders, each with the name of the 3 sites I want to build.
In Default folder I duplicated the default.settings.php file and named it settings.php, so both those files are in the same folder. (or was I supposed to put a copy of the settings.php inside each of my 3 site's folders. I don't know if I only need one settings file or 3.
In the ALL folder there is already a themes and modules folder. Once I also used a Libraries folder to hold CKeditor, do I still need to do that with Drupal 7?
Now, all I need to do is create 3 databases somehow with the exact same names as my 3 site's folders.
Am I right?
And I create the 3 databases by opening the start page in the MAMP application and going to the PHP Admin application there to create the3 databases.
Correct?
I'm using PHP 5.3.2, is that OK?
Is there any thing else I need to do before I open the index file inside the main folder that has all the Drupal files (which is named "websites" ) to start the application. Will just double clicking that index.php file kick everything off?
Thanks for any help.
Comments
Subscribing.
Subscribing.
Contact me to contract me for D7 -> D10/11 migrations.
Running Local Drupal 7 Multi-site on MAMP and Mac OS X
You seem to be on the right track. But you are missing several important steps. Specifically you need to edit your hosts file and your sites.php file.
For the benefit of others I will start at the beginning and carefully go through all of the steps that I took to run a Drupal Multi-Site local install with MAMP.
I have several client sites that I develop for. Running local versions of these sites can be messy if they are all running discrete instances of Drupal. Developing all of my sites from one installation makes it much easier to manage Core and module upgrades. It takes up less space and helps keep things tidy. Drupal 7 makes this process a bit easier to do with the "sites.php" file. I suggest reading the comments of this file at the appropriate step.
This is the procedure for running local Drupal 7 Multi-site on MAMP 1.9.x for OS X 10.5.x and up. This assumes you have Administrator access to your system. Were going to make MAMP become the default Web Server for localhost and also define localhost as "dev." We will set up 3 client sites running from one local Drupal Installation. I will name these sites "client1.dev, client2.dev, client3.dev" as examples. Replace these names with your own site names where appropriate.
Let's begin with MAMP.
[Applications/MAMP/htdocs]
[Applications/MAMP/htdocs/Drupal-7]. At this time you might change the name of your Drupal 7 Folder. I named mine D7
sudo nano /etc/hostsEnter your admin password at prompt. This will open the hosts file in the Nano Text Editor inside of Terminal.
We're going to add each of your Drupal sites to the Host Database. Edit the file to read:
client1.dev
client2.dev
client3.dev
Stating the obvious; When you add sites in the future you will need to edit your host file and your sites.php file. You will need new Sites folders as well.
I hope this was helpful.
Have fun!
Doren
I'm curious, what's the point
I'm curious, what's the point of having sites.php, what is it suppose to do ? The other steps are similar to D6, I don't understand the need for sites.php.
I believe it is so you no
I believe it is so you no longer have to create Virtual Hosts in your Apache httpd.config.
Don't quote me on that, but I did not create Virtual Hosts in my local setup and it works fine.
I'm pretty sure that's the reason. If I'm wrong someone will correct me.
If true this would also make it a LOT easier to manage a multi-site on a hosted service.
I went through this a couple of years ago with a client. A multi-site service based on sub-domain.
I recall a lot of friction with the host provider over managing Virtual Hosts and the Apace Config.
This would have saved me a lot of headaches.
Doren, i need help ...
i don't know why... it dosen't work ..
I could really use some help
I could really use some help here as well. If I set it up this way, will i only be able to create sites in drupal? And could you expand on your tutorial and include steps for moving those local sites to the live server for us that are new to this?
thanks.
Don't be discouraged
Hi Doug – don't be discouraged. I'm a designer, not a developer or IT guy. It's confusing at first. But If I can figure it out you can.
Short answer to your first question is "yes and no." It depends on the document root in your MAMP Preferences. [ MAMP > Preferences > Apache > Document Root ]. If you set the root to be your D7 directory, then all browser requests for "localhost" will serve only your Drupal sites.
Referring to my example above the URL "http://localhost" will only serve Drupal.
However, if you set the root directory to be "MAMP/htdocs" (in my setup it's "/Applications/MAMP/htdocs/"), then "localhost will allow you to serve all of your MAMP projects by pointng your browser to the proper directory. "http://localhost/D7/ or http://localhost/wordpress/.. or whatever." The Drupal multi-site will still work. You just need to append the Drupal Directory to the localhost URL when you enter it in your browser. So if you are managing a variety of CMS projects this is a better settup.
Regarding your other question (migrating local site to live server). It may seem confusing but it's fairly simple. Any complications will depend on your hosting provider. I can't help you with a difficult host. But most providers are accommodating if you have simple and specific requests. You can do this in a variety of ways. And there is a good deal of information on the Drupal.org site. You may need to dig a little.
Here's how I do it: Assuming your host meets the proper requirements (D7 requires MySQL 5.0.15 or Higher. PHP 5.3) it's pretty straight forward. Before you start, make sure that your Local Drupal core and all modules are up to date.
I like to do a clean Drupal install on the hosted server. Just FTP and unpack the TAR file in the directory of your choice (root or subdirectory). Create an empty database (usually via the host control panel or phpMyAdmin) Then run the installation script. The benefit of clean installation is that the script will return any errors or server conflicts. If the server config needs to be modified (usually "registered_globals" or something) it's easy to make a simple request of your host provider with specific information. Once your clean Drupal site is up and running then you migrate your themes and install all of the required modules via FTP.
The next step is to move your local content database... From your local MAMP launch your MAMP start page and open phpMyAdmin. Select the database for your Drupal site (left menu) and export (top tab) And save a copy of the database file to a local directory (Desktop for instance).
Then you need to access your Hosted database (usually via phpMyAdmin or via host control panel) and replace it with your local database file.
Start by opening the database in phpMyAdmin. (most host control panels provide a link that will launch phpMyAdmin in a browser window). Then "Drop" the whole thing. This will empty all data in the DB (your new, hosted drupal site will be dead. Temporarily). Then – via phpMyAdmin– "import" the database file (the one you saved locally) into your (empty) hosted Drupal database. This will include all of your content, module settings, etc.
Once you've imported your Database the hosted site should be running fine. Just be sure all of your media files are in the correct place. Any errors you might discover are usually related to file references (images, etc) or Directory permission settings. If these pop up it's usually easy to track down and fix. If you run into a snag, chances are someone else has had the same issue and you can find answers by searching the Drupal Forums.
I hope this is helpful. I know it can be confusing (maddening) if you are new to this. But once you've done it you realize how simple it is.
Good Luck!
-db
Nice breakdown on migrating
Nice breakdown on migrating sites. I thought I'd let you know of a module that makes migrating sites easy as pie - the Backup and Migrate module. You first install the backup and migrate module, and take a backup of your database through the admin interface. Then copy the local filesystem to the remote filesystem. Delete settings.php, copy default.settings.php to settings.php, and install the remote Drupal installation as always. Then enable the Backup and Migrate module, and use it to import the database dump taken earlier.
It's ridiculously smooth. As an added bonus, you can set the module to take regular backups, and save them on the server or email them or whatever. There are a lot of different configuration options. It's a great module.
Contact me to contract me for D7 -> D10/11 migrations.
vvane - I'm happy to help if
vvane - I'm happy to help if I can. I've checked and re-tested the steps above. And it works fine for me. If you can provide any other information I will try my best to respond.
-db
clean urls
Hi
I followed your instructions and everything worked.
Very detailed.
But as I start to configure the sites... I can not get Clear URLs to work.
It keeps failing the test.
Any hints as to how to fix??
I am running Drupal 7 Multi-site on MAMP 1.9.5 for OS X 10.6.8
Thanks
perfect instructions, but
perfect instructions, but one question: what if you want your two sites to share a database? I have it calling the correct database in settings.php, but I just keep getting empty table errors (and I think it's calling the wrong db) when trying to install.
Thanks.
http://drupal.org/node/146349
http://drupal.org/node/1463490
Contact me to contract me for D7 -> D10/11 migrations.
Thanks.
Thanks.
Start fresh!
It's very important to note that in order for this process to work, you must copy the settings and sites files from a fresh drupal folder. I tried to just copy already configured settings file and it screwed everything up. Just wanted to reiterate.
Awesome breakdown of the
Awesome breakdown of the steps for a MAMP setup. Very detailed and helpful. Thank you!!
WOW!
Doren Berge - you are a saint! Seriously - you are the reason Drupal (and open source projects) in general are the way of the future.
This is EXACTLY what I needed, and I would not have figured that out on my own. I know it took a good chunk of time to write this out step-by-step, so I really do appreciate your effort. It helped this guy more than you know!
- jweedman
Brilliant
Thanks Doren, this is a brilliant tutorial, exactly what I needed. I have MAMP Pro so I was able to skip a few steps but it worked great.
Danny Englander | Twitter | Instagram
Danny I need your help
I too have Mamp pro and have everything setup just like the post. However I can only get the localhost to work all the other sites get a 403 forbidden error. The error logs shows
[Thu Jan 15 19:32:16 2015] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /Users/me/Sites/d7-localhost/sites/anothersite.dev/
Also confirms permissions problem. I have permissions set to 666 on sites and settings.php file but still I can't get passed this error.
Any suggestions, I am really stuck here and would like to hear from someone who has got mamp pro working for himself.
much appreciated.
thank you!
Great, easy to follow step by step - Thank you for taking the time to post this!
thank you
worked for me like a charm, 2moro will try it on a rackspace ubuntu server