I have a confusing error with laravel 7 project. This project when I uploaded it into the main directory It worked successfully. but when I uploaded it into a subdomain it gives me 500 error. I did steps that mentioned in this answer but it didn’t work also How to set up a laravel project on cPanel subdomain? Hope someone help me
Advertisement
Answer
First Of All, I’d like to thank all contributors.
I knew the reason for the error.
In this image:
[![enter image description here][1]][1]
The file called public_html
is not in the root directory as it might seem it is.
It’s just a shortcut from : /domains/zigzagfamily.com/public_html
So when I created a folder called chatbot
in public_html
,
I wrote in index.php
:
require __DIR__.'/../../chatbot/vendor/autoload.php';
$app = require_once __DIR__.'/../../chatbot/bootstrap/app.php';
And it’s wrong because as I said public_html
is here:
/domains/zigzagfamily.com/public_html
So when I go back two folders, I’m now in zigzagfamily.com
So I must go back another two folders to be in the root directory to be able to access chatbot
folder that is located in the root directory.
Summery: the right code was:
require __DIR__.'/../../../../chatbot/vendor/autoload.php';
$app = require_once __DIR__.'/../../../../chatbot/bootstrap/app.php';