banner



How To Upload A Php To Hostgator 2018

Deploy Laravel Application on Shared Hosting

In this tutorial, I volition demonstrate the steps involved to deploy Laravel Application on Shared Hosting. I am demonstrating the steps on Hostgator.

The steps involved to Host Laravel Application on Shared Hosting will be pretty much same for whatsoever other Hosting every bit well.

Annotation: This tutorial will work well for Installing your Laravel Project to SiteGround, Bluehost, GoDaddy and other shared hosting servers.

Before moving forward make sure you have post-obit Ready.

Livewire Component Library

  • Shared Hosting Account Created (Sign Up for Hostgator)
  • You lot take Access to cPanel.
  • Laravel Application source lawmaking bachelor via Git (GitHub / Bitbucket etc.) or any other SVN

Alright, Allow'south dig into the steps to Deploy Laravel Application on Shared Hosting


PHP Version

Laravel 5.5 requires PHP version greater than 7.0. Hostgator comes with default of 5.iv.

Login to your cPanel using credentials sent to your email on Hostgator account signup.

Choose  optionModify PHP Version and change the electric current version to >vii.1

Note : You can ignore this pace if your Laravel version requires PHP 5.4 or your hosing provider past defaults provides PHP v > vii.0

Change PHP Version Hostgator for Laravel

SSH into Shared Hosting Box

As the starting time pace, Open your terminal / command line and SSH into your Shared Hosting Server

Note: SSH instructions are normally included in the welcome email. Here is the full general command to SSH into the Server

          $ ssh [username]@[server-ip]    //Replace username with cPanel username and server-ip with Server IP Address.        

Once it's able to connect to the server, It will prompt you for the SSH password, which should exist same as your cPanel account countersign

The home directory structure of shared server looks something similar this.

Directory Structure hostgator user habitation

As you can run across we have a directory public_html which is a public directory for keeping our projects. www is symlink to public_html. And then basically, they both points to same stuff.


Clone Laravel Projection

Let say in your hosting server (VPS, or shared hosting…whatsoever), you take currentwww/ directory, which is accessible publicly via web domain, for instance:

          /Users/username-blah/www/        

Now, clone your project in a new directory, which contains all your application source lawmaking, at the aforementioned level asworld wide web/, for case:

          /Users/username-blah/myLaravelProject/        

You tin can use git clone command to clone your project. Something like

          $ git clone https://username@bitbucket.org/username/myLaravelProject.git        

Make public files available to world wide web

Side by side step is to re-create all contents within themyLaravelProject/public directory toworld wide web directory. The easy example is that, with the fresh Laravel 5 installation awarding, the myLaravelProject/public/index.php should be copied to the www/index.php

Makes Sense?

Basically you need to run this command, on your server home directory (/home/username-apathetic)

          $ cp -a myLaravelProject/public/. world wide web/        

Now, your www should accept following contents

Hostgator www directory structure

Annotation : Make sure you re-create thepublic/.htaccess to theworld wide web/ also. Don't forget this, it is very important for your app routes. Without it, your routes won't be working and at that place will be a blank or empty page in every route.


Modify www/index.php to reflect new Structure

Now permit's change the www/index.php to reverberate the new structure. Don't modify theproject/public/alphabetize.php, okay? Simply modifyworld wide web/index.php, call up this!

Notice the following line

          require __DIR__.'/../bootstrap/autoload.php';   $app = require_once __DIR__.'/../bootstrap/app.php';        

And update them to the correct paths as post-obit

          crave __DIR__.'/../myLaravelProject/bootstrap/autoload.php';  $app = require_once __DIR__.'/../myLaravelProject/bootstrap/app.php';        

We are almost there, just couple of more steps !


Modify Directory Permissions

It's time to alter directory permissions of storage and bootstrap/cache directory so that information technology'due south writable.

Move to your Laravel Project into the terminal and run the following commands.

          $ sudo chmod -R 777 storage  $ sudo chmod -R 777 bootstrap/cache        

.env Configuration File

There is an .env file in your project which contains all the project variables dedicated to the environment in which the project is working.

Since our .env file should not be committed to your application'south source control. Your awarding should comprise a .env.example file bachelor. You can go ahead and copy the same file and name it .env

Generate a new application encyption cardinal

          $ php artisan key:generate        

Note: Make certain to clear cache via artisan command afterward generating the new key file (php artisan cache:clear)

Change the .env file for other required parameters such as database variables, Mail Setting Variables. etc.

There you become !!! Everything should piece of work now


Composer

Hostgator comes with composer (dependency manager tool) already installed and most other shared hosting server'due south comes with composer installed.

Check past running composer command on your terminal.

If not, you tin hands install composer with following commands.

          $ cd /User/username-blah/project/  $ ringlet -sS https://getcomposer.org/installer | php — –filename=composer        

At present you tin can execute composer to manage dependencies.

          $ php composer install  $ php composer dumpautoload -o  $ php artisan config:cache  $ php artisan route:cache        

That'due south it ! Have fun with deployed Laravel Project.

Amazon Shopping

Source: https://5balloons.info/hosting-laravel-5-5-project-on-shared-hosting-hostgator/

Posted by: devitabeary1959.blogspot.com

0 Response to "How To Upload A Php To Hostgator 2018"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel