I looked up a few tutorials online on how to install Laravel and I got to the point where composer was giving me an error saying that i needed to upgrade to PHP 5.5. Since I had 5.4 running on the server and also had quite a lot of stuff already running on this server I was left in a difficult position where I needed to install Laravel and it seemed like I was required to install PHP 5.6 or 5.5. These are not supported by the default repos with CentOS. Going down the road of using custom repos is just asking for trouble, so I decided to find a way to do this without having to upgrade. So here is how I installed Laravel using PHP 5.4.
I am going to assume that you already have apache and php installed and running on your server.
I looked around and everyone was saying to run a bunch of stuff to download and compile composer. Seems like a waste of time when it was available using yum. I’m not sure if this is required, but you should install the epel repo to make sure you can install everything you need.
yum install epel-release yum install composer
Thats it, composer is installed. Sure beats having to do a bunch of weird stuff to get it installed.
Based on the official documentation for installing Laravel 5 http://laravel.com/docs/5.0 there are 2 different ways to install. I first tried to do it via the laraval new method and this worked, but it messed up. It seemed like the version of php I was running did not live up to the requirements. I don’t know why, so i tried the second option and this worked! To do this i ran the following commands.
cd /var/www/html composer create-project laravel/laravel laravelproject "~5.0.0" --prefer-dist
This will begin the install process which can take some time as it does a whole load of stuff. Half way through i got an error message saying I needed a GitHub access token in order to continue further. Thankfully i already have a github account, but if you do not then you will need to create one.
Could not fetch https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5 b578d3865a9128b9c209b011fda6539ec06e7a5, please create a GitHub OAuth token to g o over the API rate limit Head to https://github.com/settings/tokens/new?scopes=repo&description=Composer+ on+ns358641.ip-91-121-153.eu+2015-11-17+2105 to retrieve a token. It will be stored in "/root/.composer/auth.json" for future use by Composer. Token (hidden):
To get a GitHub access token, follow this guide. https://help.github.com/articles/creating-an-access-token-for-command-line-use/
Enter the Github access token and it will continue with the install.
Once installed this should be it. If you go to the laravel/public directory in your browser you should see the default Laravel page. If you get an error 500 then it is likely due to apache not having write permissions. This can be fixed with the chown command.
chown -R apache /var/www/html/laravel