Updating Statamic on AWS

For this blog I use Statamic, a very nice website CMS bassed on Markdown and using flat files which makes it perfect for the way I work in that I can link a Drop box account to the cheap AWS server I use for hosting and then edit blogs via mobile on a wide variety of machines with just a test editor.

Anyway the site has been rock solid for ages (5500+ hours) when I suddenly realised I wanted to upgraded the Statamic version to take advantage of some new features, that’s an easy job, you just replace a couple of directories in the httpd WWW directory, but I got a couple of errors and realised that I had an old version of PHP53 on the server and I had not patched it for a while (wince). also it had been so long since I had even logged on to the box that I could not remember what to do, so this is just an aide-memoire for those in the same situation

as I’m on Linux you need to make sure your AWS pem is secure sooo

sudo chmod 644 serverkey.pem

Then connect to the box with SSH

ssh -i serverkey.pem ec2-user@XXX.XXX.XXX.XXX

Now first things first, lets do a full update

sudo yum update

Once that is done, we have to remove http and php to update them all (yes you will get an outage)

sudo yum remove php httpd php-cli php-xml php-common httpd-tools

This will uninstall the server its self (but not your website), lets install the new version

sudo yum install php55 php55-pdo php55-gd 

If you notice I added “php55-gd” to the install as you will need this for some of the new Statamic features such as the file and gallery features. Quick start the server before anyone notices

sudo service httpd start
 

You will find that the site seems to work fine, but as soon as you attempt to go to a individual blog you will find it gives you a 404, this is because the htaccess files in Statamic are being ignored so you will have to go back and tell httpd to not ignore them. so you need to edit the httpd.conf file
So first lets go to the httpd config directory

[ec2-user@ip-XX-XXX-XX-XXX /]$ cd etc/httpd/conf
 

And edit the httpd.conf file ( a good cheat sheet to vi is [Here](http://www.lagmonster.org/docs/vi.html) )

sudo vi httpd.conf

change the instances of “AllowOverride None” to “AllowOverride All”
once that is saved you just restart httpd

sudo service httpd restart

And you should be all done.