skip to main content

Ryan Hettler

Installing Laravel with Git on Godaddy

January 29, 2015

Installing Laravel with Git on Godaddy was a bit of nightmare; However, I walked away with a further understanding on the subject. With that said, I would prefer to use Digital Ocean and Forge with a vagrant box of homestead 2.0. However, since switching servers was not an option, another solution was needed to solve this issue.

Need to knows before you get started

  • Utilizing SSH
  • Knowledge of Git on the Command Line
  • Unix Commands
  • PHP Composer
  • Laravel’s artisan commands

If you would like to learn more about the above subjects, I have a collection of resources at the bottom of the page that helped me through this whole set up and Laravel in general.

The Setup

1. Clone the project in the root of folder below public_html directory.

$ git clone {{project}}@github.git

2. Install composer inside of the new directory.

curl -sS | php

4. Run composer install – do not run composer update – to bring in all of the project’s dependencies.

php composer.phar install

5.  Run the artisan migrate command to create all of your tables in SQL. Side note: It would be wise to setup environment variables in the root of your repository so database information is kept confidential. More on that later.

php artisan migrate

6. Symlink index file and directories to public_html root:

ln -s ~/{{project}}/public/index.php ~/public_html/

ln -s ~/{{project}}/public/css ~/public_html/

ln -s ~/{{project}}/public/js ~/public_html/

7. In the root directory, update .htaccess file to the following:

RewriteEngine onRewriteCond %{HTTP_HOST} ^(www.)?$
RewriteCond %{REQUEST_URI} !^/public/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /public/$1

RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(/)?$ public/index.php [L]

This solution wasn’t easy find. When it came to searching for “git and godaddy”, I was finding how to setup git on godaddy with Centos server. All credit goes to Sam Joyce’s post; without it, I would still be searching for an answer.