Getting started with CraftCMS

CraftCMS is a content-first CMS that is loved by developers and content producers alike. Of all the alternatives to WordPress that are out there, CraftCMS is one of the best. Here we look at getting started with this awesome developer-friendly content management system.

1. Download

The easiest stage of all, go to CraftCMS’s official site and get download the latest version of CraftCMS. It’s free to download and develop on, but when you come to launching your site you need to choose a licence (very cheap at $199).

2. Install MAMP

MAMP is a great tool, it allows you to run your own ‘server’ from your local machine, and is very beginner friendly, you don’t need to be a developer whizz to get this software right. Download MAMP. Follow the instruction guide, and just install a default server.

3. Spin Up Your Server

Awesome, MAMP is installed and Craft downloaded, you’re on a roll! Once MAMP has finished installing the first thing we want to do is click ‘Start Servers’ once this launches you should be presented with a screen saying ‘MAMP has been installed successfully’ if you’re on this, fantastic! If not, MAMP has great troubleshooting guides to get it up and running for you.

4. Getting into PHPMyAdmin

Firstly, we need to create a database for our CraftCMS website, so on the MAMP Installed page, under the tools menu dropdown click ‘PHPMyAdmin’ this should open up a new tab with a scary looking interface! Don’t worry, all we’re doing here is clicking one button! Click the ‘Databases’ tab located at the top, next we want to ‘Create Database’ and we’re going to name this one ‘craft_db’.

5. Moving into htdocs

Now are databases are all set up, we should shut our MAMP servers down. You can do this by clicking ‘Stop Servers’ on the MAMP window. Now let’s unzip our Craft CMS download.

‍Now, what we need to do is head into our MAMP’s htdocs folder within /Applications/MAMP/htdocs/ once you’re within this path, paste your whole ‘Craft-version-number folder within it, this will allow Craft to be able to find your install. (Also, rename your ‘public’ folder to html, this will allow easier uploading, but it’s completely your choice!)

‍6. Set Permissions

Craft needs access to things on our Mac, by default mac is very keen to protect you from the web and all the nasty things that can happen. But hey, we’re developing locally and don’t really need this protection from ourselves! Do the following commands in your terminal:

cd /Applications/MAMP/htdocs/Craft-put-your-version-name
chmod 774 craft/app/
chmod 774 craft/config/
chmod 774 craft/storage/

7. Where’s Your Database? Please Tell Me!

Now we need to tell Craft where our database is and what name it is, remember we called it ‘craft_db’. So let’s go ahead and open the following file in your favourite code editor:

craft/config/db.php

Change the following settings:

  • Set ‘server’ to the name of your database server. If your database and web server are on the same box, then this will likely be either ‘localhost’ or ‘127.0.0.1’.
  • Set ‘user’ to the name of the MySQL user Craft should use to connect to the database. MAMP usually sets a fresh install username to ‘root’.
  • Set ‘password’ to the password for the MySQL user Craft should use to connect to the database. Usually ‘root’.
  • Set ‘database’ to the name of the database Craft should be connecting to. Remember we called it ‘craft_db’ so put that here!
  • Set ‘tablePrefix’ to the prefix you want each of Craft’s tables to use. Note that this must be five characters or less, and it does not need to end with ‘_’. If Craft won’t be sharing its database with any other apps, you’re also free to leave this one blank.

Save that file, and let’s get cracking!

8. Renaming Your htaccess File

Craft is a bit silly and this is just a janitor task, what you’ll need to do is open /Craft-your version name/html/htaccess in your favourite code editor, and rename it so that it has a ‘.’ infront of it like so: .htaccess

9. Telling MAMP where to open!

Head onto MAMP, and click ‘Preferences’, you’ll be presented with another modal window. Within this window click the ‘Web Server’ tab. Change the source file to your htdocs/craft/html folder. After you’ve set it, click ‘OK’ to save these settings.‍

10. It’s the magic moment!

It can either work…or fail miserably. Let’s try! Open your MAMP window, and click ‘Start Servers’. Navigate in your browser to the following URL and you should see a beautiful screen such as: http://‌localhost:8888/admin

If you receive any errors regarding Plugins or Extensions, it means your mac hasn’t got these installed. If you’re currently getting an error stating “mcrypt extension not found” make sure it’s installed (it’s installed by default with MAMP so you should have it) but if not, please make sure to update your MAMP install to the latest version, there was a bug with the previous versions.

There’s too many errors that you may run into regarding extensions for Craft CMS, but what I would say is if any other extensions you find cause you a headache try searching for the following within Google:

“Installing extension error name e.g. mcrypt on terminal”

This should bring up lots of answers either via stackoverflow or the actual PHP site. Follow the instructions on those sites and you should be perfect!

Jonathan Kelley is a freelance web designer from London. Designing over the last 7 years for a multiple of companies ranging from small startups to global corporations. Read more about what he's up to on his portfolio. More articles by Jonathan Kelley
Home CSS Deals DesignBombs HTML HTML5 JavaScript jQuery Miscellaneous Mobile MySQL News PHP Resources Security Snippet Tools Tutorial Web Development Web Services WordPress