Laravel is an MVC framework that I’m playing around with and through trial by fire, I learned that its a bit trickier to get it installed on Shared Hosting such as Bluehost, HostGator, or JustHost (they all belong to the same parent company) than installing it on your own local machine which is easy to find tutorials for on Google.

You’ll probably encounter simular messages like:

Warning: Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI
<br />
<b>Fatal error</b>: Uncaught exception 'ErrorException' with message 'Undefined index: argv' in phar:///

Here is a tutorial I came up documenting the steps I went through.  Note that I’m using a PC and I’ll be installing Laravel into a subdomain.

 

So let’s get started!

 

First thing you want to do is to allow for SSH/Shell Access via your cPanel.  You’ll also want to note the IP address of your shared hosting since you’ll be needing that in the next step.

Screenshot of SSH/Shell Access & IP Address In C-Panel

BlueHost’s C-Panel

Once you allowed SSH/Shell access you’ll need to SSH into your hosting.  To do this you’ll need a program like PuTTy.

Once you downloaded and fire up PuTTY you would put in your shared server’s IP address and then your normal credentials you used to gain access to your cPanel.

You should then see your directory simular to what you see when you FTP into your account.  You’ll then want to navigate the directory you want to have Laravel installed.  If you forgot to create one.  The easiest method is to use cPanel and create a subdomain.  To navigate to the directory use the command cd

When you’re in the directory type in this command.

curl -sS https://getcompos er.org/installer | php

That will install composer locally on that directory.  To run composer type in:

php-cli  composer.phar

It might take awhile, but once its done, towards the end you would see something like:

Composer Install Through PuTTy

Composer Install Through PuTTy

The next thing is to install Laravel.  You would do this by using the command where testapp is whatever you want to call it.

php-cli composer.phar create-project laravel/laravel testapp --prefer-dist

You should see the default Laravel “welcome” page by going to http://www.your-domain.com/whatever-you-called-your-app/public/

Laravel Welcome Screen

Laravel Welcome Screen

But let’s make it cleaner.  Create an .htaccess file and drop it into the root of sub-domain via FTP.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ testapp/public/$1 [L]
</IfModule>

Now you can go into your subdomain like normal and you’ll see the Welcome screen.  Note that your vendor, app, bootstrap, etc.. is still accessible online.