Installing Laravel on an AWS AMI

Today I decided to install Laravel on my AWS instance to have a bit of a play and see if I can’t create something fun. The Laravel website provides incredibly good guides which contain most of the required details:

  • http://laravel.com/docs/4.2
  • http://laravel.com/docs/5.1

Upgrading packages

I am using an Amazon Linux AMI for my instance, which uses PHP 5.3 as it’s standard PHP version. Laravel requires PHP version 5.5.9 or above, so first things first, install PHP 5.6:

sudo yum remove php* httpd*
sudo yum install httpd24 php56
sudo yum install php56-mysqlnd php56-gd php56-mbstring
service httpd start

This removes the old versions of PHP and Apache that are installed, installs updated versions of both, and then will install some extra PHP packages that are required, and finally starts Apache back up.… Read the rest

Using Apache environment variables in .htaccess

In a previous post I talked about using environment variables to make your life easier when developing on multiple servers. In this post I will talk about how to use these variables in your .htaccess file.

Why .htaccess?

You may want some rules specific to different servers, maybe you want to hide certain paths on your live server, or perhaps you want to use a different robots.txt file. Below is a rule I’ve used to server a different robots file on a live server.

RewriteCond %{ENV:TESTSERVER} !yes
RewriteCond %{REQUEST_URI} robots.txt
RewriteRule (.*) robots.txt.block
  • Is the environment variable ‘TESTSERVER’ NOT equal to ‘yes’?
Read the rest