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

BrownieCoffee's avatar

HTTP ERROR 500 Laravel shared hosting (planet hoster )

Hi there,

I trying to deploy my project to shared hosting ( planethoster ). I use Filezilla and actually my structure is that

- goshr
- public_html
	- index.php
	-.htacess 
	- .....

I replace

__DIR__ . '/../bootstrap/autoload.php'

to that

__DIR__ . '/../app_folder/bootstrap/autoload.php'

and same for the other declaration on index.php

here my htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    #RewriteRule ^(.*)/$public / [L,R=301]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]
    

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]


</IfModule>

Before deployment, I optimized my project and I added permissions.

Can you help me please?

0 likes
19 replies
laracoft's avatar

@browniecoffee

  1. Where did you get these steps from?
  2. Do not modify any file inside public e.g. index.php

This is the correct way for Laravel


\yourdomain
├── app
└── public          <- DocumentRoot MUST point here, i.e. https://yourdomain
    └── robots.txt  <- MUST be able to load https://yourdomain/robots.txt
├── vendor
...
└── storage
1 like
Snapey's avatar

is it a laravel 500 error?

If so, what is in the Laravel log file?

BrownieCoffee's avatar

@laracoft I follow many threads on stackoverflow and medium about deployment in shared hosting. This steps recommended to move folders and files inside 'public' in 'public_html' and the others folders and files on project root inside a created folder in host.

So I edited my public for the paths.

@snapey It's not an error from laravel. This error in given by chrome.

laracoft's avatar

@browniecoffee

  1. Show us the links. It makes totally no sense.
  2. Follow the structure I gave you if you want us to help you.
Snapey's avatar

Your .htaccess should be unchanged from the default.

Make sure the storage folder is writable

1 like
laracoft's avatar

@browniecoffee

If you can, reinstall Laravel from scratch. Just don't touch the files and upload to your server.

laracoft's avatar

@jlrdw

Yea and this is not the first time the question is duplicated.

But those who come teach public_html without clearly explaining the security implications ought to be quartered.

jlrdw's avatar

@laracoft the laravel news article does teach:

From article:

quote

If you have Laravel installed in a subfolder, please check that none of the dot files or the other directories are accessible through the browser, and if they are you can hide them by moving the out of the web root, or using .htaccess on Apache, or Nginx config. The best option is to move them above the web root and here is how you can setup Laravel in that situation.

unquote

I trust the writer of that article, he is the one who does laravel-news.com

And the one from novate is from snapey website.

I trust those two how-to articles, otherwise I wouldn't place them here.

But @browniecoffee if you do choose to install all under public_html (not advised) make sure you cannot read your .env in the browser. But how you install will be your choice.

@laracoft I agree security should be explained as well.

Both articles cover that.

BrownieCoffee's avatar

@snapey @laracoft @jlrdw Okay I did a fresh reinstall. Now I have Symphony error : There is no existing directory at "/var/www/html/Goshr/storage/logs" and it could not be created: Permission denied

EDIT: I did : php artisan route:clear

php artisan config:clear

php artisan cache:clear

jlrdw's avatar

If you uploaded the project, the folder should be there.

Open site in something like WinSCP, create folder, and make sure permissions are assigned.

I am not familiar with planet hoster, but on two other shared I haven't had such problems.

Have you considered just using Digitalocean since you are having these problems?

Also make sure you pointed correctly to main laravel folder.

Many of these problems is because a path is not resolved correctly.

Please or to participate in this conversation.