Melodia's avatar

Laravel deployment gives 500 Internal server error

I am trying to upload a laravel site to GoDaddy but I get an internal server error.

owlcrest.sidneylab.com

1 - I uploaded the folder of my project to the root directory 2 - Copied the content of the public folder inside a folder in my public_html folder 3 - I changed the index.php to the following:

require __DIR__.'/../owlcrest/vendor/autoload.php';

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

I have composer installed and updated.

Created the database and assigned it to a user.

The .env file configurations are set and I generated a new key.

Anything else I am posssibly missing?

0 likes
4 replies
lostdreamer_nl's avatar

so the structure is now:

  • /owlcrest/app/...
  • /owlcrest/bootstrap/...
  • /owlcrest/config/...
  • /owlcrest/vendor/...
  • ...
  • /public_html/index.php

If so, you can try setting the permissions on both /app/bootstrap/cache & /storage/* so the app can write to its logs and cache files.

After that, if you still get a 500, you should at least have some more info in your storage/logs/laravel.log file.

Melodia's avatar

No @lostdreamer_nl The project is in the root directory, and I named it owlcrest. In the public_html, I create another folder called owlcrest, which has all the content inside te public folder of the project.

So I have: /public_html/owlcrest/index.php

Hope I could explain better

lostdreamer_nl's avatar
Level 53

So the structure is like this?

/owlcrest/app/...
/owlcrest/public_html/owlcrest/index.php

In that case, you should change your index.php to this:

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

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

// or maybe 
require __DIR__.'/../../owlcrest/vendor/autoload.php';
$app = require_once __DIR__.'/../../owlcrest/bootstrap/app.php';

Simply make sure that the path is correct relative from index.php (so UP to folders (out of owlcrest, out of public_html), and then into the laravel folder to vendor/autoload.php & bootstrap/app.php)

2 likes
Melodia's avatar

The last one worked:

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

You really saved my day. Appreciate the support

1 like

Please or to participate in this conversation.