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.

The process of updating PHP and Apache did nothing to negatively impact the existing site I had running on this server – other than having a very short period of downtime. So this process seems very safe and straight forward.

Adding executables to the PATH

After installing laravel and composer it’s good to add the executable to your PATH variable, so that you can just type ‘laravel’ to perform commands. This can be done in two simple steps:

echo 'pathmunge pathmunge ~/.composer/vendor/bin' > /etc/profile.d/laravel.sh
chmod +x /etc/profile.d/laravel.sh

This will safely update your PATH variable to include the laravel/composer bin folder. You will need to log back in to your instance for this to take affect.

Apache

Apache needs to know where Laravel is! The document root should be your laravel installations ‘public’ folder. This is where all of the public facing files will reside.

Laravel!

Say hello to the new branch of the site: laravel.mhayward.it

Published by

MHayward

I am a Web Developer who has been creating websites and hacking at WordPress for over 4 years. I'm a graduate of Surrey University where I studied Computer Science.

Find me on linked in http://uk.linkedin.com/in/mhayward89