Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy laravel 4.2 on shared hosting?

I developed an application with laravel 4.2.8 and now I am having trouble deploying it. I followed this answer https://stackoverflow.com/a/16683938/3153380 but its not working. I am getting a white screen and the headers are returning a 500 Internal Server Error status.

I read around that laravel 4.2 is a bit tricky to set up on shared hosting is this true? I can seem to find a working solution so those that have deployed 4.2 before please help. My folder structure is like below

root/ laravel_base/ app/ ... public_html/ siteroot/ assets/ packages/ uploads/ index.php ... Any pointers?

like image 740
zinyando Avatar asked Sep 08 '14 12:09

zinyando


People also ask

Can I deploy laravel on shared hosting?

Q: How to deploy Laravel on shared hostingDo ZIP your Laravel project. Create a database in your cPanel. Import the local exported database into shared hosting database. Upload project ZIP file to public_html folder and extract.


1 Answers

First make sure that your shared host runs php >= v5.4. Second try to follow this steps:

  1. Create a folder outside your public_html/ or www/. Ex: project/
  2. Copy every folder and file (except the public folder) from your laravel app into that project/ folder
  3. Copy the content of public/ folder into your public_html/ or www/ (the .htaccess must be there too)
  4. Inside public/ locate the index.php file and change the following paths:

    a. Path to autoload.php

    require __DIR__.'/../bootstrap/autoload.php';
    

    into

    require __DIR__.'/../project/bootstrap/autoload.php';
    

    b. Path to start.php

    $app = require_once __DIR__.'/../bootstrap/start.php';
    

    into

    $app = require_once __DIR__.'/../project/bootstrap/start.php';`
    

After all that it should be working.

like image 66
Helder Lucas Avatar answered Sep 24 '22 13:09

Helder Lucas