61 posts / categories / feed

Setting up Laravel4 on Site5 Shared Hosting

The basic PHP requirement for setting up Laravel4 >= php version 5.4, however currently the default installed php for Site5 shared hosting is PHP 5.3. Fortunately, they provided PHP version 5.2, 5.3, 5.4. Although Site5 offers the option to setup laravel from within Cpanel, the result will be that the full app installation would be done onto the document root, however it was strongly discouraged due to security.

Steps to Install Laravel

Step 1: Login to terminal via SSH access

Step 2: Do a pwd to ensure that you are in /home/[user]

Step 3: Download composer.phar, enter curl -sS https://getcomposer.org/installer | php

Step 4: Enter /usr/local/php54/bin/php composer.phar create-project laravel/laravel –prefer-dist to install

Step 5: If there is issue during the installation, user /usr/local/php54/bin/php artisan clear-compiled

Step 6: You should be able to see the laravel folder within the /home/[user]

Step 7: Move the contents within public folder to /public_html

Files Required To Make Changes

There are a few files that are required to change:

  1. laravel/bootstrap/paths.php
  2. public/index.php
  3. public/.htaccess


// change the following:

'public' => __DIR__.'/../public',

// to

'public' => __DIR__.'/../../public_html',


// change the following:

require __DIR__.'/../bootstrap/autoload.php';

// to
require __DIR__.'/../../laravel/bootstrap/autoload.php';

// change the following:

<span style="line-height: 1.5em;">$app = require_once __DIR__.'/../bootstrap/start.php';</span>

// to
$app = require_once __DIR__.'/../../laravel/bootstrap/start.php';


<IfModule mod_rewrite.c>
 <IfModule mod_negotiation.c>
 Options -MultiViews

RewriteEngine On

# Redirect Trailing Slashes...
 RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^ index.php [L]

# include this to handle php 5.4
AddHandler application/x-httpd-php54 .php .php5