concrete5 Beginner's Guide

By Remo Laubacher
    What do you get with a Packt Subscription?

  • Instant access to this title and 7,500+ eBooks & Videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Free Chapter
About this book

Concrete5 is a content management system for PHP developers. It can be used to build a range of sites and is particularly optimized for creating marketing websites.

The Concrete5 Beginner's Guide will show you how to get up and running with Concrete5 as quickly and painlessly as possible. Taking you from installation to deployment, this is the only reference that you will need for creating your new Concrete5 site.

By using a number of real-world examples, as well as taking you through the set up of a sample site, this book will enable you to become familiar with all of Concrete5's features. Use add-ons, themes, and blocks to give your site the look-and-feel that you desire. Simple PHP will enable you to customize the layout and navigation options of your site, as well extend the dashboard giving you a fully functional, professional site in no time.

Publication date:
March 2011


Chapter 1. Installation

In this chapter you'll learn what you need to get your own concrete5 site up and running on your local computer. You don't need to have a lot of experience with Apache, PHP, and MySQL configuration as we're going to use XAMPP, which will install all the necessary components in almost no time.

Before you can start working with concrete5, you have to set up an environment where you can test and play around with concrete5 to get used to it. If you have a web hosting account, you can install concrete5 there, but since that isn't always the case, we'll install everything concrete5 needs to work smoothly on your local Windows computer.

The local webserver will only be used to build and test the site as well as the add-ons we're going to create. In the last chapter of this book, we're going to move the site from your local computer to a live webserver.


Preparing for installation

There are a few tools you'll need before you can start the installation process. You probably already work with similar tools, but let's still make sure you've got everything before continuing.

Web browser

concrete5 supports all major browsers as long as you're working with an up-to-date version. Please note: You can create a website which is viewable with Internet Explorer 6.0. The In-context editing system won't work with Internet Explorer 6.0 which means that you won't be able to update the content of your website, unless you use a more up-to-date web browser like Internet Explorer 7 or higher.

Whether you use Firefox, Chrome, Safari, or Internet Explorer doesn't really matter. concrete5 works with any recent browser with JavaScript capability, but it's recommended to use the latest browser version since most concrete5 community members test new releases with the newest browsers.

Text editor

Since we're going to edit lots of files you'll need a text editor. The requirements are quite small; you can pick almost any text editor you want. Just make sure it does support PHP syntax highlighting. If you don't work with PHP very often, here are some possible editors:

  • PSPad (Windows only, free), A simple text editor with built-in FTP support. This can make a quick fix on your website even quicker.

  • Coda (Mac OS only, commercial), A very slick and clean editor, FTP support, CSS editor.

  • Notepad++ (Windows only, free), A small and fast replacement for Windows notepad.

There are a lot more text editors, as mentioned previously; you can use almost any editor you want. If you're familiar with another product, just go with it. You won't find anything in this book where you need a special text editor feature.

Archive utility

The same with the file archive utility; there are plenty of tools you can use as long as it extracts standard ZIP files. If you don't have any archive utility installed, you can go with IZArc; it's free and does a good job.

FTP client

Once more, there are lots of choices. You'll have to change file permissions later, so make sure your FTP client includes this option. A powerful and well known client is FileZilla, It's free as well and has a lot more features than we need.


XAMPP installation

If you think you've found all the tools you'd like to use to create your website, you're ready to install XAMPP.


Time for action – installing XAMPP

concrete5 is a PHP application which uses PHP as its programming language in combination with a MySQL database. There are lots of possibilities to meet the requirements of concrete5. The preferred web server is Apache, IIS should work as well but isn't supported by the core team, even if it isn't as well tested as Apache.

If you already have a server or a local Apache, PHP, and MySQL setup, you can skip this step and continue with downloading concrete5. Otherwise, you are going to need to install XAMPP on your local computer by following these simple steps:

  1. Go to and click on XAMPP for Windows. Scroll down and download the latest version of XAMPP Lite. If you're not very familiar with these tools, you should download the EXE and not the ZIP. Double-click the EXE as soon as it has been downloaded. You should see the following window:

  2. Click Install to start the installation process; it will take a while as it extracts quite a lot of files. You can install XAMPP in your program directory C:\Program Files but it won't work on Vista unless you modify some privileges. If you don't feel comfortable changing your security settings, just use C:\ instead.


    If you want to know more about the security changes needed on Vista to install XAMPP in your program directory, go to this page and follow the instructions:

  3. After the installation has completed you'll see an old fashioned console window asking a few questions. They look like this; you can confirm all default values:

  4. At the end you'll see a menu where you can execute different actions. You'll later have to start the XAMPP Control Panel but let's leave this screen untouched for now; we have to make one modification first.

    Before you start XAMPP, you should change one MySQL setting. MySQL table names are not case sensitive on Windows. This will cause some problems if you want to move your site to a Linux server where MySQL is by default set up with case sensitive table names. It's therefore recommended to change this, if you work with concrete5:

  5. Go to the directory where you've installed XAMPP, open mysql and then bin. It should look like the following:

  6. The my.ini file contains several settings related to MySQL. Open the file and locate the section mysqld and insert the following line:

    lower_case_table_names = 0

    The first lines should then look like the following:

    # Example MySQL config file for medium systems.
    # This is for a system with little memory (32M - 64M) 
    # where MySQL plays an important part, or systems 
    # up to 128M where MySQL is used together with
    # other programs (such as a web server)
    # You can copy this file to
    # /etc/my.cnf to set global options,
    # mysql-data-dir/my.cnf to set server-specific options 
    # (in this installation this directory is @localstatedir@)
    # or
    # ~/.my.cnf to set user-specific options.
    # In this file, you can use all long options that a 
    # program supports.
    # If you want to know which options a program supports, 
    # run the program with the "--help" option.
    # The following options will be passed to all MySQL clients
    #user       = your_username
    #password   = your_password
    host        = .
    port        = 3306
    socket      = "MySQL"
    # Here follows entries for some specific programs
    # The MySQL server
    lower_case_table_names  = 0
    basedir                 = "C:/xampplite/mysql/"
    datadir                 = "C:/xampplite/mysql/data/"
    port        = 3306
    socket      = "MySQL"
    key_buffer              = 16M
    max_allowed_packet      = 1M
    table_cache             = 64
    sort_buffer_size        = 512K
    net_buffer_length       = 8K
    read_buffer_size        = 256K
    read_rnd_buffer_size    = 512K
    myisam_sort_buffer_size = 8M


    Downloading the example code for this book

    You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

  7. Now that MySQL is properly configured, go back to the XAMPP console menu and enter 1 to open the control panel where you can start and stop all components. You should see the following window:

  8. Start both Apache and MySQL, and your web server will be up and running in no time, ready for concrete5!

  9. If everything worked you should be able to open your browser and enter http://localhost/. On this screen you can select your preferred language and you'll see a nice status page about XAMPP.


It might just happen that Apache doesn't start because port 80 is already used by an application like Skype. You can click on Port-Check to see if there are any ports being used before you start the XAMPP services. If there are, either disable the other services, or reconfigure, or stop them.

What just happened?

The XAMPP setup package installed a working web server, including PHP with the most commonly used modules and a MySQL database. This is what a lot of web applications need, an environment which works for a lot of web applications and CMS's as well.

You've also had a quick look at one MySQL configuration file to avoid problems when moving your data to a Linux server. If you want to know more about this setting, the MySQL documentation is going to answer almost any question about table names:


Please don't forget, XAMPP is by default a user-friendly and simple system but insecure to simplify the development process as much as possible. It is nice to work with and great for your first experience with your own web server, but not recommended for a production environment. Later in this book, we'll move your site to a LAMP server (Linux, Apache, MySQL, and PHP) which is more widely used by webhosting companies with a more secure configuration.

Pop quiz – requirements for concrete5

Like any other software, concrete5 needs certain things to run. Try to answer which of the following items are true:

  1. Which of the following server-side programming language(s) has been used to build concrete5?

    1. PHP

    2. Microsoft ASP

    3. Java

    4. All of the above

  2. Which of the following database(s) can you use with concrete5?

    1. PostgreSQL

    2. MySQL

    3. Oracle

    4. All of the above

  3. Which of the following operating system(s) can you use to run concrete5?

    1. Microsoft Windows

    2. Mac OS X

    3. Linux

    4. All of the above

  4. Name the webserver(s) you can use to run concrete5.

    1. Microsoft IIS

    2. Nginx

    3. Apache

    4. lighttpd


Downloading concrete5

Your local web server is running, there is nothing else to prepare, and you are ready to install concrete5 now. There are just a few more steps till you can log in to concrete5.


Time for action – downloading the latest version

Before we can install anything we have to get the latest concrete5 version from this URL: and follow these steps:

  1. Open the ZIP archive and extract all the files to C:\xampplite\htdocs. Override the files which are already in the directory.

  2. After you've extracted the ZIP file you should see a structure like the following:


At the time of writing, concrete5 v5.4.1.1 was the latest version. You can download a newer version if available; changes in the installation process should be minor if there are any at all.

What just happened?

You've downloaded and extracted the concrete5 CMS files. Depending on your archive utility it might have been the case that empty folders like updates, files, and others hadn't been created. Make sure your structure looks like the one shown in the preceding screenshot.

Before we continue, a few words about the file structure you've just created. It's important that you understand the structure of concrete5 before you start working with it. It's helpful to have a clear understanding about the structure so you can find your files easily. You'll later see that all add-ons in the marketplace follow this structure. Using the suggested structure helps to keep a clean structure, no matter who builds the concrete5 site or add-on.

It might look a bit bulky to have so many folders in the root of your website but you'll realize that it makes perfect sense to have this structure the more you work with concrete5. To give you a first impression about the most important folders:




Put your custom blocks in this folder; you'll learn more about blocks in the next few chapters.


Probably the most important part; this is where all core files, the actual CMS, is located. Never update anything in this folder.


The folder where concrete5 puts the configuration files.


The file manager stores your files in this directory.


This is where you have to put add-ons if you install them manually.


The concrete5 auto update feature puts the new core in this directory.

There are a few more folders but you probably won't need them unless you dive deep into concrete5. We won't use them in this book and therefore won't mention them.


Creating an empty SQL database

You must create an empty SQL database before you can install concrete5.


Time for action – creating an empty SQL database

Use phpMyAdmin which is included in XAMPP Lite to create the database:

  1. Open http://localhost/phpmyadmin/ or hit the Admin button next to MySQL in the XAMPP control panel and you should see the following page:

  2. Enter concrete5 as the database name.

  3. Select the collation utf8_general_ci.

  4. Hit Create.

  5. Go to the Privileges tab and click on Add a new User to create a dedicated user for concrete5.

  6. When prompted, use the following credentials to fill in the following fields:

    • User Name: concrete5

    • Host: localhost This makes sure that the user can only be used if the database is accessed by the local machine.

    • Password: concrete5 The password to access your database. Feel free to use a more secure password than concrete5, just make sure you remember it when we install concrete5 in the next step.

  7. Hit Go and the user is available and your database is ready for concrete5!

What just happened?

All the components are ready; Apache including PHP should be running and there's an empty MySQL database to host your concrete5 site.


Please note: concrete5 can't be installed in a database which isn't empty!


Installing concrete5

We're finally ready to get to the concrete5 part. Let's install it!


Time for action – installing concrete5

To install concrete5, follow these steps:

  1. Open your favorite browser and enter http://localhost/. You should see the installation screen:

  2. On the left there are a few checks to make sure that your web server meets all the requirements of concrete5. A few words about the required items:

    • PHP: Whenever possible, try to use the latest PHP version.

    • JavaScript and MySQL : At this point, concrete5 only works with MySQL and needs JavaScript because of its AJAX interface.

    • C5 Request URLs: By default you'll see index.php in each concrete5 URL you open. To get rid of this, you need to have the Apache module mod_rewrite, which we're going to deal with later in this chapter.

    • Image Manipulation and XML Support: These are PHP modules which are enabled by default and needed by concrete5.

    • Web Server Access to Files: Usually not a problem if you work with XAMPP on Windows. The webserver must be able to write some files in your website's installation directory. We'll discuss this issue later, when we move the site to the production server.

    • Version Comparison: This feature uses Python to show you the difference between page modifications. A nice feature but it doesn't work because XAMPP Lite doesn't install Python. But since it's optional we're not going to worry about it.

  3. To install concrete5 you have to enter the following personal information:

    • Name Your Site : Any name you want—can be changed in the dashboard later.

    • Your Email Address: The admin mail address. Make sure it exists; this is where you'll receive a link to change the eventually forgotten admin password.

  4. You will also have to enter the following database information:

    • Server: Since the database is running on the same machine as the web server, just enter localhost.

    • MySQL Username, MySQL Password, and Database Name: concrete5 or whatever you used when you created the user in phpMyAdmin.

  5. Sample Content: If you enable this, concrete5 will create a few sample pages to play around with. Enable this, if you're new to concrete5, it will create some nice pages where you can see the different blocks you can use to build your website.

  6. If you've entered all the necessary information, click Install Concrete >!

What just happened?

A few seconds after you've clicked Install Concrete you should see a screen with an automatically generated admin password. Make sure you don't lose it.

concrete5 is installed and ready to work with on your computer!

You should now be able to open the default concrete5 website, by entering http://localhost/ in your browser.

The configuration file

After you've successfully installed concrete5 you'll find a file called site.php in the config directory. This is where the installation process has saved the information you've entered during the process. Here's how it looks:

define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'concrete5');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'concrete5');
define('BASE_URL', 'http://localhost');
define('DIR_REL', '');
define('PASSWORD_SALT', 'zc8tSsYQI0E2MifRwboxBq6K9UmbL4X7vrf3Tz1unNFVCPWkO5glHjZaGpADJ');
  • DB_SERVER , DB_USERNAME, DB_PASSWORD , and DB_DATABASE are obviously just database related. If the credentials to access your MySQL database have changed, this is where you have to modify them to make sure concrete5 can access your database.

  • BASE_URL is used by default to make sure that your website visitors use your primary domain. If your site is accessible by multiple domains, concrete5 will just forward them to the URL specified in BASE_URL.

  • DIR_REL is empty if you've installed your website in the root. It's only filled if your website is located in a subdirectory.

  • PASSWORD_SALT, this is a random string and is used in combination with the password to generate the password hashes found in the user table. Salts are used to complicate dictionary attacks and even if they are useless without a password you should still not publish a real password salt to keep your site safe.

Pop quiz – the configuration file

  1. You'll often have to check or modify a few lines in the configuration file, so where can you find it?

    1. <concrete5 installation directory>\config.php

    2. <concrete5 installation directory>\config\config.php

    3. <concrete5 installation directory>\config\site.php

Pretty URLs

When you browse to a subpage in your concrete5 site you'll notice an odd thing in every URL: there's index.php in it like this http://localhost/index.php/about/. Every request to a page in concrete5 is processed by index.php. This has several advantages: It's easier to check the permissions, there's a single point where the page rendering time can be improved, and a few more things.

However, even with these advantages you probably wouldn't like to see index.php in every URL. Luckily it's rather easy to change it if your web server supports rewrite rules. XAMPP does, and here's what we have to do.


Time for action – enabling pretty URLs

Follow these steps to get rid of the index.php from you URLs:

  1. Log in to concrete5.

  2. Click on the Dashboard button in the top-right corner.

  3. Select Sitewide Settings in the navigation.

  4. Check Enable Pretty URLs and hit Save, you should see the following screen:

  5. concrete5 should have created a file called .htaccess in the root of your website. This is the file where the rewrite rules are stored which remove index.php from the URLs.

    You can now open a subpage by entering http://localhost/about/—the index.php is gone.

What just happened?

Congratulations, you're done! concrete5 is running and you've also activated some options to improve the behavior of concrete5.

You've enabled pretty URLs which uses the Apache mod_rewrite module to rewrite URLs. In case you'd like to know more about this Apache feature this is the official documentation:

.htaccess is a configuration file most commonly used by Apache to configure Apache modules on a directory level. It's a simple text file you can open with any text editor of your choice. If you haven't worked with Apache before, the content might be a bit confusing but concrete5 took care of it. You shouldn't have to modify anything on your own in this file.


Pretty URLs can also be used with Microsoft IIS but you need to install a rewrite filter first.

If you want to try it on your own, you can find a solid and free rewrite filter at this address:



You've reached the end of Chapter 1!

  • You should now have a working concrete5 installation from where you'll learn how to work with concrete5.

  • In case you have to check or modify your concrete5 configuration, you should know where to find the files.

  • We've looked at the requirements to run concrete5.

  • All the tools you'll need to go though this book should be installed in your computer.

  • We're going to use this test site to build our own site including some customization and programming.

About the Author
  • Remo Laubacher

    Remo Laubacher grew up in Central Switzerland in a small village surrounded by mountains and natural beauty. He started working with computers a long time ago and then, after various computer-related projects, focused on ERP and Oracle development. After completing his BSc in Business Administration, Remo became a partner at Ortic, his ERP and Oracle business, as well as a partner at Mesch web consulting and design GmbH. At Mesch—where he's responsible for all development-related topics—he discovered concrete5 as the perfect tool for their web-related projects and has since become a key member of the concrete5 community. You can find his latest publications on

    He has also authored concrete5 Beginner's Guide and Creating concrete5 Themes.

    Browse publications by this author
concrete5 Beginner's Guide
Unlock this book and the full library FREE for 7 days
Start now