Skip to content

Installing SilverStripe CMS

G17th February 2014

C2 Comments

TApache, SilverStripe

Installing the SilverStripe content management system on an Apache server isn’t easy, but these instructions will guide you through.

SilverStripe is a free, open-source content management system (CMS) that can be used for a range of web applications. Despite being used by a large range of large enterprises, this CMS is considerably more difficult to install than WordPress. I wrote these instructions to document my experience installing SilverStripe 3.1.2 (framework and CMS) on an Apache server to benefit others who may experience the same problems that I faced.

Step 1. Set up your server

Before you begin, you will need to check that your server meets the minimum requirements. These include:

  • PHP: 5.3.2+
  • Memory: 48MB+ for each PHP process
  • PHP modules: dom, gd2, hash, iconv, mbstring, mysql (or other database driver), session, simplexml, tokenizer, xml
  • Databases: Either MySQL 5.0+, PostgreSQL 8.3+ (requires “postgresql” module) or SQL Server 2008 (requires “mssql” module)
  • Web servers: Either Apache 2.0+ with mod_rewrite and “AllowOverride All” set (Apache 2.4+ also requires “DirectoryIndex disabled” & “Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec”) or IIS 7+

Create your directory and/or subdomain to install (in this example, it will be called http://www.yourserver.com/silverstripe/) and then upload a file called test.php with the following code into the root. This will be used for later troubleshooting.

<?php
phpinfo();
?>

Go into cPanel and set-up a MySQL database and account with the appropriate permissions.

Step 2. Download SilverStripe

The SilverStripe CMS and Framework can be downloaded from the SilverStripe website.

For simplicity on a Windows 7 machine, download the .zip version and extract files somewhere onto the C:\ drive.

Step 3. Upload SilverStripe

Using an FTP programme of your choice, upload the extracted files to http://www.yourserver.com/silverstripe/

Step 4. Fix problems with memory

After installing SilverStripe, I received the following notice: Fatal error: Allowed memory size of 33554432 bytes exhausted. Until this problem was fixed, installation could proceed no further.

Depending on the configuration of your server, you will likely need to increase the amount of memory that SilverStripe is allowed to access. To see how much memory is available to SilverStripe, go to http://www.yourserver.com/silverstripe/test.php and scroll down to memory_limit. This will usually be set to 32MB.

Fixing this common problem is a two-step process.

First, open .htaccess and add the following lines, where /home/mysite/public_html/silverstripe/ is the server path to your installation:

<IfModule mod_php5.c>
php_value memory_limit 128M
</IfModule>

SetEnv PHPRC "/home/mysite/public_html/silverstripe/"

The second line ensures that the memory limit changes affect all subdirectories, not just the top directory.

Then create another file called php.ini and add the following lines of code to this file:

magic_quotes_runtime = Off
magic_quotes_gpc = Off
magic_quotes_sybase = Off
get_magic_quotes_gpc = 0
display_errors = 0
date.timezone = Australia/Melbourne
memory_limit = 128M

By adding this code now, you will avoid the problems that I faced in Step 5 below. In essence, these changes turn off magic_quotes and display_errors in PHP and set the appropriate time zone. My time zone setting is date.timezone = Australia/Melbourne, however if you live somewhere else, you will need to adjust this setting using the correct syntax.

Step 5. Perform installation

To install SilverStripe, go to http://www.yourserver.com/silverstripe/install.php.

A system check will be performed and any errors indicated. For my install, I received the following errors:

  • date.timezone option in php.ini must be set correctly
  • fileinfo should be enabled in PHP
  • magic_quotes_gpc is set to ‘1’ in php.ini
  • display_errors is set to ‘1’ in php.ini
List of errors in SilverStripe installation window

When installing SilverStripe 3.2.1, I received many errors.

If you have made the appropriate changes to .htaccess and php.ini above, these errors should not be present. Don’t forget to add your database login details under “Database configuration”.

Step 6. Update Constants.php

Despite all of these changes and updates, I continued to receive a message at the top of my window stating that Warning: get_magic_quotes_gpc support is being removed from Silverstripe. Please set this to off in your php.ini and see http://php.net/manual/en/security.magicquotes.php in xxxxxxxxxx/framework/core/Constants.php on line 134.

This appears to be a false alarm: From the changes I made to php.ini and .htaccess above, I knew that magic_quotes had been switched off. To remove this notice, open /framework/core/Constants.php and change this code at line 134:

} else {
	/**
	 * Fix magic quotes setting
	 */
	if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
		if($_REQUEST) stripslashes_recursively($_REQUEST);
		if($_GET) stripslashes_recursively($_GET);
		if($_POST) stripslashes_recursively($_POST);
		if($_COOKIE) stripslashes_recursively($_COOKIE);
		// No more magic_quotes!
		trigger_error('get_magic_quotes_gpc support is being removed from Silverstripe. Please set this to off in ' .
		' your php.ini and see http://php.net/manual/en/security.magicquotes.php', E_USER_WARNING);
	}

to this:

} else {
	/**
	 * Fix magic quotes setting
	 * <-- Removed trailing slash from this line
	if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
		if($_REQUEST) stripslashes_recursively($_REQUEST);
		if($_GET) stripslashes_recursively($_GET);
		if($_POST) stripslashes_recursively($_POST);
		if($_COOKIE) stripslashes_recursively($_COOKIE);
		// No more magic_quotes!
		trigger_error('get_magic_quotes_gpc support is being removed from Silverstripe. Please set this to off in ' .
		' your php.ini and see http://php.net/manual/en/security.magicquotes.php', E_USER_WARNING);
	}

Once this change was made, the installation completed successfully.

A final thought

SilverStripe is a terrific CMS (I have really been impressed) but the installation documentation requires a lot of improvement, especially for those who don't/can't install via the terminal. I had to spend hours searching the internet for solutions to these problems when the answers rightfully belong on the SilverStripe website. Hopefully the documentation will be improved in future but for now, I trust that my experience will be of use to others.

   

Comments:

2 responses to “Installing SilverStripe CMS”

  • Written by Cam Findlay on 6 July 2014:

    Hey there, nice tutorial – ideally though you don’t want to “hack the core” otherwise every upgrade you’ll have to remember to port your hacks over to the new version (which is a common problem with many big software packages leading to non-upgrading, budget over runs for IT projects, and sometimes security problems).

    You could perhaps look to reduce the php warning levels to get rid of the message without changing core files.

  • Written by Adam Dimech on 12 July 2014:

    Hello Cam,

    You are correct, and that’s exactly what I found when I upgraded from 3.1.2 to 3.1.5.

    I should definitely have a look into the reduction of PHP warning levels.

Have your say:

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.