Installing Laravel on GoDaddy Shared Hosting Site

A while ago I starting playing around with Laravel on my GoDaddy Hosting account.  GoDaddy makes it really easy to get started with Laravel, and numerous other frameworks, and assorted web application.  It has an “Installatron” app in cPanel which automatically installs a package for you, and configures it all for you.  That seems nice, but it turns out to be a bad thing to use in this case.

The first limitation, is that it doesn’t support the most recent version of Laravel.  Even if I don’t need the most recent version, it’s nice to control the version I’m using.  When learning via an online tutorial, I want to use the same version as in the tutorial.  Another issue, is that to get the full usage out of Laravel it’s necessary to use the Composer package manager.  This is great if you use Composer to install Laravel, but not so well if Laravel is installed for you by Installatron.  Without Composer I can’t add new packages to enhance Laravel, which cripples development and learning.

So, I got a fresh start, and avoided Installatron altogether.  I used Composer to install Laravel.  To be able to do this, I had to use the command line.  I got an SSH client, BitVise SSH, which has worked really great.  I get to a command line, using my GoDaddy login credentials.  GoDaddy already has Composer installed, so I used it.  That was a mistake.  I got lots of errors on the install, and realized GoDaddy has an outdated verison of composer.  So, I had to install the latest version myself.

Now, I was able to install Laravel without any error messages.  Things were getting better.  But, now there’s a potential security problem unique to shared hosting accounts like GoDaddy.  Normally, with Laravel you install everything under one parent directory.  This includes the “public” sub directory, which is what is served to the public by the web host.  Now, if you have a full server setup, you just make this “public” directory your the public directory for your web server, and keep everything else separate.  Unfortunately, you can’t change the directory that gets served publicly on GoDaddy’s shared hosting account, which has a preset “public_html” directory for that.  So, it’s necessary to move the contents of this “Laravel/public” sub-directory in the Laravel installation separately under the “public_html” directory that serves web pages on a GoDaddy account.

That starts another problem.  When serving pages from public_html, it’s necessary to for Laravel to connect the page served (index.php) to the full installation of Laravel.  That involves changing a couple references public/index.php.  But, then came the next problem.  I relied on GoDaddy’s file manager in cPanel to move around my files.  The problem is that it doesn’t display “hidden” files, which are any files that start with a dot (“.”).  This included an “.env” file that it’s the base directory of the Laravel installation.  That produced more errors.  Finally, I fixed that, and alas, everything worked.