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

alierfani's avatar

L5.1: how to deploy to shared hosting properly?

I have deployed my Laravel 5.1 app to a shared hosting. I have created an addon domain using Cpanel. So I have a folder named "motarjeman" in public_html for this domain. Then I have uploded my project to this folder. All of my project files are in folder again called "motarjeman". Then I copied all contents of the public folder to the /public_html/motarjeman. At last I have modified the index.php in the root directory (i.e in the /public_html/motarjeman) as following:

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

Is it the right way?

0 likes
5 replies
ShaunL's avatar

@alierfani I've had issues but not on shared hosting but I know your pain with CPANEL. Is there a reason why your creating a sub domain instead of putting the files outside of public_html?

alierfani's avatar

@ShaunL There are other blogs hosted on this service, so I need to create an addon domain. Anyway, I found the solution after some searching around . I modified the document root for this domain and changed to /motarjeman/public . This was the easiest and best solution. Thank you @Snapey @davidrushton and @jlrdw for your help.

Please or to participate in this conversation.