Posts Tagged ‘ WordPress multisite ’

Installing WordPress Multisite with MAMP on OS X

So I’m finally able to purchase a Mac, and now I’m moving all of my design work over to it. I need to start working on developing a network of sites using WordPress 3. I’ve waited so long. Man, did I ever not know anything about WordPress. Here are some of the things I’ve learned in the past 9 hours of figuring out how to get WordPress 3 running on my Mac running Snow Leopard. Excuse me while I borrow others words (links will be posted to give where credit is due). My comments will be noted.

Step 1: Installing MAMP

Before you can install MAMP on your Mac, you’ll need to download it from the MAMP website. MAMP requires that your Mac is running Mac OS X 10.4.x or later.

Once the MAMP download completes, double-click on the MAMP disk image (it should be something like MAMP_MAMP_PRO_1.9.dmg), and you should get a MAMP window pop up. Drag the MAMP folder (not MAMP PRO) to the Applications folder.

Step 2: Basic MAMP Settings

Now that you’ve got MAMP installed on your system, launch MAMP.app (located at /Applications/MAMP/MAMP.app).

While you’re editing settings, MAMP might prompt you for an administrator password. This is required because MAMP needs to run two processes: mysqld (MySQL) and httpd (Apache), and depending on the settings you set for those processes, you may or may not need to input your password.

Once you open MAMP, click the Preferences button. Next, click over to “Ports.” The default MAMP ports are 8888 for Apache, and 8889 for MySQL. If you use this configuration, you shouldn’t get asked for your password, but you’d need to include the port number in the URL (localhost:8888). If you’d like to leave the port number out of the URL, change the Apache port to 80. The downside of using port 80 as your MAMP Apache port is that you’ll always be asked for your password. For multisite (network), you need to click “Set to default Apache and MySQL ports.” These port are 80 for Apache and 3306 for MySQL. Apache needs to be port 80 for network site to work.

On the PHP tab, you can select either PHP version 5.2.13, or PHP version 5.3.2. This generally won’t effect WordPress, unless you’re using a plugin that requires PHP 5.

Lastly, on the Apache tab, you’ll need to set a document root. This is where all of your files are going to be for your local web server. An example of a document root is /Users/USERNAME/Sites/wordpress/.

Once you’re done editing all of the settings, hit OK to save them.

Step 3: Starting MAMP Servers & Creating The Database

To start the MAMP Apache and MySQL servers, simply click “Start Servers” from the main MAMP screen. Your MAMP servers have now been started.

Once the MAMP servers start, the MAMP start page should open in your default web browser. If not, click on “Open start page” in the MAMP window. Once that’s open, select phpMyAdmin from the webpage.

Under “Create new database”, enter in a database name such as “wordpress”, and press “Create.”

Step 4: Downloading and Installing WordPress

  • Now it’s time to download WordPress. Once you’ve downloaded and unzipped the WordPress download, open up the “wordpress” folder. Click and drag all of the files from the wordpress folder to your MAMP document root (I use/Users/USERNAME/Sites/wordpress/).
  • Rename the wp-config-sample.php file to wp-config.php.
  • Open wp-config.php in a text editor and fill in your database details as follows: username is root and password is root. (STOP and read Step 4.1 before finishing the last bullet.)
  • Run the WordPress installation script by accessing localhost/wordpress/wp-admin/install.php in a web browser.

Once that’s complete, enter a blog name and email address, and you’re ready to use WordPress on your Mac. (steps 1-4 link and bullets link)

Step 4.1: Edit host file and httpd.conf

To create a simi-real virtual environment, edit your host file. Add mycoolsitename.dev or any name you like next to localhost. (e.i. 127.0.0.1   localhost mycoolsitename.dev)

  1. Open the Terminal.app. Either by start typing Terminal on the Spotlight, or by going into Applications/Utilities/Terminal.
  2. Open the hosts file. Open the hosts by typing on the Terminal that you have just opened: $ sudo nano /private/etc/hosts Type your user password when prompted.
  3. Edit the hosts file. The hosts file contains some comments (lines starting with the # symbol), as well as some default hostname mappings (e.g. 127.0.0.1 — localhost). Simply append your new mappings underneath the default ones or edit one of the default values. You can navigate the file using the arrow keys.
  4. Save the hosts file. When done editing the hosts file, press control-o to save the file. Press enter on the filename prompt, and control-x to exit the editor.
  5. Flush the DNS cache. On Leopard you can issue a simple Terminal command to flush the DNS cache, and have your host file changes to take immediate effect: $ dscacheutil -flushcache

(numbered items link)

Now edit your httpd.conf file.

Put these lines at the bottom of the httpd.conf file (located at Applications/MAMP/conf/apache/httpd.conf)

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot “/Users[Your User Name]/Sites/”
ServerName localhost
VirtualHost>

<VirtualHost *:80>
DocumentRoot “/Users/[Your User Name]/Sites/wordpress”
AllowOverride All
ServerName mycoolsitename.dev
</VirtualHost>

Substitute “[Your User Name]” with your Username. After that you have to reboot or type “lookupd -flushcache” in the Terminal to make these changes take effect. Make sure you set MAMP’s ports to the default Apache and MySQL ports. Click the “Set to default Apache and MySQL ports” in Preferences/Ports.

(httpd.conf code link)

You can try and skip Step 4.1, but I pretty sure you need it.

Step 5: Create Network

See here and begin at step 3. I will say that everything before step 3 is good to read, but you will start the network creation at step 3. (I think step 5: enabling the network is where I messed up bad.) Because your local copy of WordPress is not going to have .htaccess you will need to create it exactly where it says (e.i. /Users/[Your User Name]/Site/wordpress). The easiest way to create a .htaccess is through an ftp program like fireftp (at least that’s what I did). Create a file named “htaccess,” open it in your text editor, and paste the code that needs to be added from step 5; enabling the network. Save and close the file. Then, use your ftp program to change the name from “htaccess” to “.htaccess.” Make sure your .htaccess is in the correct folder/directory. After completing the steps from the link you should be ready to use your new multisite blog.

If this doesn’t help anyone, I know it will help me.

Advertisements