Amazon EC2 for Facebook – Upgrading to PHP 5.2

Okay, so we started looking into using EC2 to power Facebook applications. Now, EC2 is not your garden variety virtual hosts. You get a reasonable amount of RAM and processor power, but that means you are not paying $6 a month any more.

The basic system types are

Small Instance (default)*

    1.7 GB memory
    1 EC2 Compute Unit (1 virtual core with 1 EC2 Compute Unit)
    160 GB instance storage (150 GB plus 10 GB root partition)
    32-bit platform
    I/O Performance: Moderate
    Price: $0.10 per instance hour

Large Instance

    7.5 GB memory
    4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each)
    850 GB instance storage (2 x 420 GB plus 10 GB root partition)
    64-bit platform
    I/O Performance: High
    Price: $0.40 per instance hour

Extra Large Instance

    15 GB memory
    8 EC2 Compute Units (4 virtual cores with 2 EC2 Compute Units each)
    1,690 GB instance storage (4 x 420 GB plus 10 GB root partition)
    64-bit platform
    I/O Performance: High
    Price: $0.80 per instance hour

So, if you get your calculator out, 10c an hour is $72 a month before you add in bandwidth and additional storage for your customized AMI.

Anyway, the initial set up all went very smoothly using the EC2 getting started guide.

After I connected to the instance, first the housekeeping

yum update

Next, I needed PHP 5.2.x rather than the default 5.0.4 – Something to do with SimpleXMLElement in case anyone is interested

If you just need PHP to work with JSON, use

 yum install php-json

If you need PHP 5.2, here’s the steps

cd /etc/yum.repos.d
wget http://remi.collet.free.fr/rpms/remi-fedora.repo
yum --enablerepo=remi update mysql
yum --enablerepo=remi update php
apachectl restart

Hope this saves someone some time.