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 https://getcomposer.org/installer | 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.)?ryanhettler.com$
RewriteCond %{REQUEST_URI} !^/public/

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

RewriteCond %{HTTP_HOST} ^(www.)?ryanhettler.com$
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.

Resources

  • Shaun L

    Ryan, great post. Looking forward to reading more of your stuff. Is this for shared or dedicated hosting? It sounds more like dedicated based on the article but I could have missed it.

    • Ryan Hettler

      For my particular case, it was a shared hosting plan with GoDaddy. However, if you can avoid it, I would highly recommend a VPS.

      Thank you for your comment Shaun!

    • For my particular case, it was a shared hosting plan with GoDaddy. A dedicated hosting plan / VPS would be a great way to go; it should prevent a lot of headaches and restless nights.

      Thank you for your comment Shaun!

  • Francis Claide Magallen

    heeey, I tried in laravel 5.3 but I get this error.

    Generating autoload files
    > IlluminateFoundationComposerScripts::postInstall
    > php artisan optimize
    Script php artisan optimize handling the post-install-cmd event returned with error code 255