Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

matus's avatar

L5 on shared hosting

Hello everybody,

is it possible to run new laravel on shared hosting?

Thanks

0 likes
14 replies
meganlkm's avatar

@InFloW that works great if the server has no other purpose. Otherwise it is helpful to keep all of the code together.

matus's avatar

Hi guys,

thanks for the answers. However, my question was basically about the folder structure. I do not run artisan command on the hosting.

With L4 I divided the whole laravel folder in 2 folders. I put public folder in public_html folder and the rest of the folders like app, vendor and etc. put to a folder i created. Then I changed paths in new_folder/bootstrap/paths.php and in public_html/index.php. That was the whole process.

In L5 the whole folder structure has changed, so I was thinking about the possibilities of running L5 on shared hosting.

Thanks

Snapey's avatar

I just posted an article about publishing to a shared hosting (Heart Internet in the UK). I focussed on using subdomains, but the principles are the same. It was a lot easier with L5 than with L4 with only the paths in the index.php folder needing to be changed.

http://novate.co.uk/deploy-laravel-5-on-shared-hosting-from-heart-internet/

I now know what I need to do to publish Laravel5 alongside wordpress - just stick it in a subdomain...

3 likes
cibermesias's avatar

I uploaded my project to a hosting server and the index page alomst works, but every link is broken. The hosting uses PHP 5.6. Any suggestion?

miladrahimi's avatar

It works in shared hosting perfectly. I just renamed public to public_html (and I added a public_path() override registrar in App Service Provide) then uploaded my localhost project in the server.

AddWebContribution's avatar

Follow the below given simplest steps to setup laravel on server. First you need to install composer then after install laravel into your server. Once laravel installation process completed, copy and paste all the file from(check for hidden files as well) /public to SERVERROOT/laraproject/. Here laraproject is new directory need create into server root folder.

Now you just need to setup the SERVERROOT/laraproject/public/index.php like:

  1. Copy SERVERROOT/laraproject/public/index.php and to SERVERROOT/index.php and create .htaccess like SERVERROOT/.htaccess
  2. Find and replace below lines into SERVERROOT/index.php:
  • require __DIR__.'/../bootstrap/autoload.php'; to require DIR.'/../laraproject/bootstrap/autoload.php';
  • $app = require_once DIR.'/../bootstrap/start.php'; to $app = require_once DIR.'/../laraproject/bootstrap/start.php';
  1. Add below lines into SERVERROOT/.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^awesome-project
RewriteRule ^(.*)$ laraproject/$1 [L]

Now your laravel application 'laraproject' is ready to run. Enjoy!

Snapey's avatar

@saurabhd

... and voila - your .env file is available for the world to see

by the way. This 2 year old thread is about shared hosting where you almost never get to use composer.

1 like
bunnypro's avatar

i'd rather make a symbolic link from Laravel public directory to the public_html. Easiest step to make it works in a shared hosting.

vijayrana's avatar

@Snapey, following your suggestions, it works perfectly fine. I have successfully deployed Laravel 5.4.19. Thank You for your article :) Cheers!!!

Please or to participate in this conversation.