Search code examples
phplaravelpermissionslaravel-8

Laravel, unknown error after deploy to LIFE server, 500 Internal Server Error


I just deployed a laravel 8 project from my local server to a LIFE server, everything went OK apparently, I managed to run composer successfully (composer update), composer doesn't throw any error message, the domain of the LIFE server is linked with the folder /project/public. I have also managed to run php artisan migrate with success, I can see the tables created by artisan in the database, so the application is correctly connected with the database.

I have also changed the permissions of the main project folder to 755 and the permission of the storage folder to 777.

sudo chmod -R 777 ./storage
sudo chmod -R 777 ./bootstrap/cache/
sudo chmod -R 664 /mainprojectfolder

I successfully generate a new KEY with artisan, and I managed to clear the cache with artisan... In other words, I have been through all the tutorials that I found online, but the problem is not resolved.

php artisan key:generate

I have also managed to clear the project cache as the official documentation suggests with:

php artisan config:cache
php artisan route:cache
php artisan view:cache

I have also created the .htaccess file:

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

    RewriteEngine On

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

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

When I browser the server URL, I see that the browser is correctly redirecting to domain/login, which is correct, as long as I am not logged in the application redirects to the login page. Then the browser displays the classic: 500 Internal Server Error - The server encountered an internal error or misconfiguration and was unable to complete your request...

Unfortunately, I don't have access to the server logs because the server is a shared virtual server, so I can't figure out what the problem exactly is.

Can you guys please suggest?


Solution

  • I finally found the solution after a lot of attempts, the .htaccess file was wrong and I swapped:

    RewriteRule ^ index.php [L]
    

    with:

    RewriteRule ^ /index.php [L]
    

    I added the / before index.php. This has fixed the problem.