Site icon Donner's Daily Dose of Drama

First steps with the SilverStripe Open Source CMS

I learned about SilverStripe through an article in the German C’t magazine. The way it can be extended seems to be cleaner and better servicable than it’s competitors. The website of the 2008 Demcocratic Convention was built with SilverStripe, which should address concerns about scalability.
I decided to try it out, since our clients at pod frequently ask for Open Source content management solutions, and SilverStripe could be a perfect platform for LAMP implementations.

In this first post, I am describing how to obtain the software and how I got it up and running at my ISP. In subsequent posts, I will walk through the steps that were required to convert our company web site from an ASP site with static content to SilverStripe.

Downloading and extracting the SilverStripe archive

In the following command line examples, the ¬ character is used to indicate that the command continues on the following line due to space contraints of the blog page.

The first step was to create a directory under the HTML root on the shared server at my web hoster (webhostingbuzz.com). I decided to call the new folder silverstripe, since I did not intend to set up a domain for the site, and I am just going to use it for learning the product.

[~/www]# mkdir silverstripe
[~/www]# cd silverstripe
[~/www/silverstripe]#

Next, I downloaded the archive from the SilverStripe.org site, uncompressed it, and extracted the files into my newly created folder:

[~/www/silverstripe]# wget http://silverstripe.org/assets/ ¬
downloads/SilverStripe-v2.2.3.tar.gz
[~/www/silverstripe]# gunzip SilverStripe-v2.2.3.tar.gz
[~/www/silverstripe]# tar -xvf SilverStripe-v2.2.3.tar
SilverStripe-v2.2.3/
SilverStripe-v2.2.3/.htaccess
SilverStripe-v2.2.3/UPGRADING
SilverStripe-v2.2.3/ChangeLog
[...]

Now, since everything was untared into a new folder called SilverStripe-v2.2.3 underneath my /www/silverstripe folder, I moved the files up one level. Alternatively, I could have started in my www folder and then renamed the subfolder, but I don’t like to experiment with files in my html root folder.

[~/www/silverstripe]# cd SilverStripe-v2.2.3
[~/www/silverstripe/SilverStripe-v2.2.3]# mv * ..
[~/www/silverstripe/SilverStripe-v2.2.3]# ls
./  ../  .htaccess
[~/www/silverstripe/SilverStripe-v2.2.3]# mv .htaccess ..
[~/www/silverstripe/SilverStripe-v2.2.3]# cd ..
[~/www/silverstripe]# rmdir SilverStripe-v2.2.3

Now the files were in place and I was ready to hit the SilverStripe installation page at https://cdonner.com/silverstripe (don’t try to hit this URL – I just made it up for this post).

Preparing to run the SilverStripe Installer

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /www/silverstripe/install.php on line 518

Ouch, what happened? A quick Google search for the error revealed that I am not running PHP 5 by default. So I did another test:

[~/www/silverstripe]# php -v
PHP 5.2.5 (cli) (built: Feb 19 2008 08:37:43)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
    with Suhosin v0.9.23, Copyright (c) 2007, by SektionEins GmbH
    with Zend Optimizer v3.3.0, Copyright (c) 1998-2007, by Zend Technologies
[~/www/silverstripe]#

Looked like 5.2.5 to me. So why the error? To make the long story short, while PHP 5 is installed on the server, Apache does not use it by default. In order for the correct version to be used for SilverStripe, I needed to edit the file .htaccess (mind the period in the filename – it is important), which was previously empty, to contain the following two lines (the file will grow during the installation process, though, and will ultimately contain a lot more lines):

AddType x-mapp-php5 .php
AddHandler application/x-httpd-php5 .php

Now the error went away and Apache served the installer page (if you type http://yourdomain/silverstripe into your browser’s address bar). A quick scan of the page revealed that yes, I still had to set up a MYSQL database, but after scrolling down further to the bottom I found another issue – not enough memory for PHP, in big red letters.

Not enough memory for SilverStripe

I confirmed that the limit is 8M by creating a phpinfo.php page in my silverstripe folder with one line of code in it:

< ?php phpinfo(); ?>

When I hit this page, I saw that the PHP memory limit was indeeed 8M. Other sources suggest that the PHP memory limit can be set in the server’s the php.ini, or by adding a line to the .htaccess file. Neither worked for me. I created a local php.ini instead with the following content:

[PHP]
memory_limit = 32M;

This file needs to be in the silverstripe folder and, in order for the installation to be successful, also in the silverstripe/sapphire folder. I refreshed the Installer page – heureka, the warning went away and the “Install SilverStripe” button became available.

The only things left to do were creating a database (I used myPHPAdmin, which is available on my provider’s administration site), creating a database user (which I did directly on my hosting administration page), and entering the database information on the SilverStripe Installer page, along with the administrator password. Once the database was created, I clicked on Install, and it completed successfully.

Exit mobile version