Category Archives: Apache

Tips on Install of WordPress on Mac OSX

Prerequisites / WordPress Dependencies

Local Apache web server with PHP & Mysql.

If you don’t already have your local dev environment set up, consider installing MAMP or MAMP Pro. MAMP is a one-click install which will provide you with a clean, isolated stack for local development that has Mysql and PHP pre-configured. Another benefit of MAMP is that it is very popular so there are countless tutorials and examples to follow.

If for some reason you don’t want to use MAMP or you’ve already configured your local enviro somewhat but you still need PHP and/or MySQL, check out this article: Install and Configure WordPress on Mac OS X Snow Leopard Step-By-Step by awilliams of Thermal Exposure. It takes you from zero to WordPress using Leopard’s built-in Apache server, although I do recommend you supplement these instructions with these tips and my other article Install Mysql for Local Dev on Mac OSX 10.6

Download WordPress

Download and extract the latest WordPress package.

Move it somewhere good like in your /Sites/ folder (most usual place but depends on your config, it can go anywhere you desire so long as your local web server is configured to look there).

I moved mine to /users/me/Sites/wordpress and renamed ‘wordpress’ to ‘wptest.loc’ resulting in: /users/me/Sites/wptest.loc. You can rename it whatever you want – probably the name of your project or client’s site is a good idea.

WordPress needs permission to modify files during installation and runs as user “_www” so make sure it can do this.

cd /Users/me/Sites/
sudo chown -R _www wptest.loc
sudo chmod -R g+w wptest.loc

Create a Database

Now we need a database, a database user and a password. Technically you can use any user or add WordPress tables to an existing database but I like to keep things separate so it’s easy to port elsewhere or start over without worrying about wrecking other things. I’m going to create a database called wptest, database user named wptest_user. You can do this using a GUI (phpMyAdmin, etc.) but I guarantee you cannot do that faster than I can type this ;)

bash > mysql -u root -p
mysql > create database wptest;
mysql > GRANT ALL ON wptest.* TO wptest_user@localhost IDENTIFIED BY "secretpassword";
mysql > exit

Configure Site Address

Remember how I renamed the wordpress folder to wptest.loc? This is because I plan on accessing it in the browser via http://wptest.loc instead of or http://localhost.

To do this I use Virtual Hosts in my environment and point the virtual domains to my local IP address in my hosts file. It’s confusing at first but once you do it a time or two it will be second nature. It’s important if you’d like to work on multiple sites on your local environment concurrently and don’t want to rely on weird subdirectories or other work-arounds that wouldn’t easily port to a live web server.

Setting Up Virtual Hosts on MAMP explains how to set this system up. I provide only abbreviated steps below (MAMP not assumed).

Setting up Virtual Hosts (in short)

  • In your httpd.conf file there should lines like this:
    # Virtual Hosts
    Include /path/to/your/httpd-vhosts.conf

  • In your httpd-vhosts.conf file there should be a line like this:
    NameVirtualHost *:80
    Include /path/to/your/httpd-vhosts.conf

Create A Virtual Host

Now, whenever you want to create a new virtual (local only) site:

  • In your httpd-vhosts.conf file add an entry like this:
    <VirtualHost *>
        ServerName wptest.loc
        DocumentRoot "/Users/me/Sites/wptest.loc"
      <Directory "/Users/me/Sites/wptest.loc">
        Order allow,deny
        Allow from all
        DirectoryIndex index.php index.html

  • In your hosts file (mine is /etc/hosts) add another entry for your local IP:    wptest.loc

Install WordPress

Point your browser to http://wptest.loc

If no config file is found you can edit it yourself, wp-config-sample.php as wp-config.php and adding the correct information for the database you created. Try using as the Dataase Host if localhost doesn’t work.

Install Mysql for Local Dev on Mac OSX 10.6

Do not be intimidated, it’s not that hard.

If you don’t mind reading a little documentation, the hardest thing about installing Mysql (IMO) is figuring out what package to install.

If you’ve previously tried and failed (and done who knows what to your local config) or if you don’t have a particular reason not to, why don’t you just get MAMP and skip all this?

USE THIS INFORMATION AT YOUR OWN RISK. Any information found on this website is offered only as informational and includes no warranty, guarantees or support. The author claims no authority on any subject whatsoever.

  1. Go to
    • This will offer latest version (yes, you want the MySQL Community Server, btw) – if you have a good reason, you can access a previous version from here as well.
  2. Choose the DMG Archive for your architecture (32-bit or 64-bit). You’ll have to log in or (more likely if you’re reading this article) register with MySQL. It’s annoying but fast and I’ve never received spam from them.
  3. After jumping through sign in and mirror download hoops you’ll have a DMG file, something like mysql-5.x.x-osx10.6-x86.DMG which will contain an similarly named .pkg file. That’s all you need. But the most important file is the ReadMe.txt – which is actually useful and contains important steps you need to take. Open the ReadMe.txt.
  4. Read the ReadMe.txt file.

Ok, before you get mad at me – a lot of folks don’t provide useful ReadMe files, which is why I think it’s worth calling out in this case. Also, I saw so many tutorials on this, and worse, problems in forums where it was clear they didn’t follow the steps provided. Also, there are docs online that are mostly a repeat of this file – but it’s easy to accidentally read instructions for the wrong product version. So, as we OGs say, RTFM.

Following are notes from my specific install experience. It may be useful for you but you’ll need to verify your own system paths and configuration. Happy databasing!

  • Restarted apache a whole bunch, can’t remember when or exactly when you need to but if something doesn’t work, that might help:
    sudo apachectl -k restart

  • I installed MySQLStartupItem.pkg – while regularly using it this makes sense, and it’s easy to stop auto startup when you’re done working on a project using mysql. Also the commands to start Mysql are much shorter this way and I’m lazy.
    $ sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

  • Update my PATH environment variable:
    //make a back up in case you muck something up
    $ sudo cp /etc/paths /etc/paths_BAK 
    // edit your paths file - see vi reference or using pico, vim, emacs whatever
    $ sudo vi /etc/paths
    // insert /usr/local/mysql/bin and then save/quit
    // test result
    $ echo $PATH
    // do you see /usr/local/mysql/bin in there somewheres? good!
    $ mysql
    // is bash prompt replaced with mysql> ? yay!

  • Create a password for root:
    $ mysqladmin -u root password aw3^s0mePAs5

More good notes (for 5.5, be sure to select correct manual option):

What Next?

  • Login, create a db, do stuff, lern stuff
    $ mysql --help
    $ mysql -u root -p
    mysql> SHOW DATABASES;
    mysql> \h
  • Install a GUI - I like 'em, it's nice for visualization, although I think you definitely learn more & more better if you stick with CLI or at least the query window.
    • Sequel Pro - recently turned onto this. LOVE it. Good review here.
    • MySQL Workbench - the official one. Cause you're a company wo/man!
    • PHP MyAdmin - cause you an OG! And/or you follow or make a lot of tutorials (most apache web hosts provide this).
    • Querious - cause it's worth a few bucks for a nice user experience.
    • Navicat - cause money is no object! (If that's the case, please get me a copy! Love but cannot justify $$ at this time.)

Drupal 5.x on Ubuntu LAMP

The quick and dirty dev install of Drupal on Ubuntu

USE THIS INFORMATION AT YOUR OWN RISK. Any information found on this website is offered only as informational and includes no warranty, guarantees or support. The author claims no authority on any subject whatsoever.

Why Drupal, Why Ubuntu?

For me it's all about community. I've always enjoyed apache web development in part because of the active and helpful user groups, forums, irc channels, etc. I use Ubuntu as the operating system for my LAMP because it's really popular right now - it has a very active forum and pretty good documentation. Drupal is an open-source content management system, or you could look at it as a framework since it was built to make it easy for coders to override almost anything it does without hacking the core. This means you could make it do anything you want if you happen to be good enough at PHP and still take advantage of core development and security updates no matter how much you modify the product.

Why write installation instructions?

Good question? Well, the installation instructions at are good but they cover all sorts of environments (who wants to slog through all that?) and those in the Ubuntu Community Docs are great and pretty specific but cover Drupal 4.6.7 and 5.1. I probably should update the docs at Ubuntu, perhaps I will after I hash it out here and after a few people let me know they worked or what to change. Also, I like to search for instructions specific to my situation whenever I approach a new installation. It's good to see what other people in similar circumstances have encountered, I call it due diligence. I would suggest any user doing this install review the documentation mentioned above thoroughly. Also see related links at the end of this article.


These instructions don't cover the setup of your server environment. Mine happens to be:
  • Ubuntu 6.06 LTS server
  • Apache
  • PHP 5.1.2
  • MySQL 5.0.22

Get Drupal

tar -zxvf drupal-5.7.tar.gz

I'm a big fan of apt-get but there were a lot of issues in the forum started by people having problems with Drupal in the repositories. Community Docs recommend getting the latest package from, right now that happens to be Drupal 5.7. (Drupal 6 is out now as well, and is very cool, but CCK/Views aren't ready for prime-time and I'm installing for the purposes of following tutorials written for 5.x.)

Move Drupal

sudo mkdir /var/www/drupaltest
sudo mv drupal-5.3/* drupal-5.3/.htaccess /var/www/drupaltest
sudo mkdir /var/www/drupaltest/files

My apache install is pretty much setup to default config. /var/www is my web root, yours may vary. Because I'm just using this particular install as a test which I plan on destroying later I'm going to put it in the boring old subdirectory 'drupaltest', actually I named mine d57_test_01 but thought drupaltest would be more comprehendable in the example.

In the mv command we explicitly move .htaccess because it's a hidden file.

Database Setup

mysqladmin -u root -p create db_drupaltest
mysql -u root -p

Create the database for Drupal to use - you can replace 'db_drupaltest' with whatever you'd like to call the database. You'll need to enter your mySQL root password. If you get an access denied error make sure you're using the mySQL root password and not your login or Ubuntu root password. The second command puts you in mySQL monitor, the command line interface for managing your MySQL server. The commands in the next code section are SQL. You could also run this in phpMyAdmin if you'd rather have a GUI.


Change the datebase name, the username 'drupal_usr' and 'secretpassword' to whatever you like. Just don't forget to write it down somewhere safe because you'll need to know it later.

Edit Settings.php

sudo vi /var/www/drupaltest/sites/default/settings.php

Using vi (or whatevs) change the $db_url line. Note: If you use a fancy charcters or dashes in your user, password or database names replace them URI hex encodings, this is detailed in database settings comments section in the settings.php file.


Up Your PHP Memory Allocation

If you have a new LAMP install the default memory setting for scripts is 8M. This is redonkulous and Drupal will suck. Look for the 'Resource Limits' section and change memory_limit to 32M and then restart apache.

sudo vi /etc/php5/apache2/php.ini sudo /etc/init.d/apache2 restart

Final Steps

Go to http://localhost/drupaltest/install.php (or your servername instead of localhost if DNS is setup). You should see this:

Screenshot of Drupal Installation Message

One last thing, if you click Administer you will probably get a 'one or more problems were detected' error message. Two things: your files directory isn't writable and you cron job hasn't run. The first one is easy - just make the files area writable by all:

sudo chmod 777 /var/www/drupaltest/files

As for cron, you can just click 'run cron manually' on the Status report page - but you'll need to do this anytime you want to update the index. For a quick dev install you're likely to trash soon it may not be necessary but for a production or long-term dev install you'll want to set up a cron job to hit http://localhost/drupaltest/admin/logs/status/run-cron every few minutes depending upon your site's traffic and requirements. See Configuring cron jobs in Drupal's Getting Started guide for more.

That's it. Good luck folks, now enjoy surfing the Drupal learning curve...heheh.

Related Links

Kill is Your Friend

Ah, slowly I am earning my beans in Ubuntu land. Tonight I had my first legitimate need to use kill and even found out what a PID number was and EVEN read my LOG FILES!! Wow. If you’re just learning Apache admin stuff and just can’t reload or restart your web server, head on over to /var/log/apache2 and check out your error.log file. You prolly shouldn’t randomly kill .pids but if you’re getting a repeated httpd error like mine: “httpd (pid 5347?) not started” it could be that the server was manually shut down (oops, old Windows debugging tactic) and the process just needs to be murdered.

kill 5347

Worked like a charm. Another hint for you fellow newbs…maybe reading an Apache admin book would actually SAVE you time, eh? All I needed to do to enable my dern rewrite was to change AllowOverride None to AllowOverride all in my sites-enabled config. Hmmm….I bet a quick doc on configuring sites in Apache2 would have saved me all that. But then I wouldn’t have ever found out how to kill stuff on linux…so then again, maybe it was all worth it.

Awesome drawing by pure evil bunny on Flickr.