jeudi 20 février 2020

Laravel 5.8 Fresh Deployment Not Working In Hostinger Shared Hosting

I tried to deploy a fresh laravel application. I installed a laravel 5.8 and upload to github repository.

The repository or project folder is working since I tried to run php artisan serve and it successfully shows the laravel home screen page.

I tried to connect in my shared hosting using ssh.

Here's the steps that I've done:

  1. Access thru ssh
  2. create a project folder mkdir my-assignment-calculator then cd my-assignment-calculator
  3. Clone project repository. git clone **repo_url**
  4. Navigate the project folder, cd my-assignment-calculator
  5. Copy .env file, cp .env-example .env
  6. Install composer packages. composer install
  7. Then copy all files in Public folder to public_html folder
  8. Go to public_html then update index.php, nano index.php
  9. In index.php, I update these two lines, the vendor/autoload.php and the bootstrap/app.php

Here's the sample code for #9:

require __DIR__.'/../my-assignment-calculator/my-assignment-calculator/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once 
__DIR__.'/../my-assignment-calculator/my-assignment-calculator/bootstrap/app.php';

Here's the structure of my project folder

-public_html
-domains
    --my_assignment_calculator
    --my_assignment_calculator
        ---laravel files

The current output is only white screen. I tried to check the developers tools or devtools, there's no error. It's just a white background. It's the same as before.

I tried to check .htaccess file and I didn't touch this file. Here is the .htaccess:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

So what is the expected output

Should display laravel welcome or home screen page



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire