0

Im trying to deploy my laravel project with namecheap however I'm getting a 500 server error.I've updated the server.php and index.php to point to the correct directories but I'm still getting the error. I've checked the error.log file in the public_html directory but it doesn't give any error when loading the site. I've also double checked the .env file to make sure the correct database credentials were entered.

index.php

if (file_exists(__DIR__.'/../nue/storage/framework/maintenance.php')) {
    require __DIR__.'/../nue/storage/framework/maintenance.php';
}
require __DIR__.'/../nameofproject/vendor/autoload.php';

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

server.php

require_once __DIR__.'/../nameofproject/public_html/index.php';
1
  • You shouldn't be editing the server.php or index.php files. Such configuration should be done via your apache or nginx config files. Commented Aug 16, 2021 at 20:33

2 Answers 2

1

Whenever I deploy my Laravel project in a sharedhost. These things I do

  1. Copy the entire application directory (appname) inside public_html

  2. Path to the domain will be "public_html/appname/public"

  3. Link storage path using ssh

Sign up to request clarification or add additional context in comments.

Comments

0

If your Laravel project is installed in the webroot (assuming public_html), then do the following:

  1. Move the contents of public/ up one dir to the webroot. index.php and server.php should now be in the same dir as your .env.
  2. In index.php, change ../vendor/autoload.php to just vendor/autoload.php and ../bootstrap/app.php to just bootstrap/app.php.
  3. In server.php, change public/index.php to just index.php.

2 Comments

I did some more digging and checked the error log again. I can see that the its looking for the vendor/autoload.php file in the public_html folder (PHP Fatal error: require(): Failed opening required '/home/.../public_html/nameofproject/vendor/autoload.php'). However I have my project located outside of the public_html folder in a separate directory. Which file do I change to point it to the correct path?
"I have my project located outside of the public_html folder in a separate directory" - What actual dir might that be?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.