php

Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04

Problem

This is the first time I am installing Laravel on Ubuntu and I am already running into issues, 500 errors. I have done it before, numerous times on Windows OS and never had an issue.

This 500 internal server usually happens when your “mod_rewrite” module is not turned on.

On Ubuntu, I have installed rewrite_mod but it’s also not working. I’ve given access to all my folders and files inside i.e.

/var/www/html/laravel_project

Still it doesn’t work. Changed .htaccess as well from original to this.

+FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Generally, I have all the extensions needed for Laravel 5+ as well. Anything that I might have missed?

Solution

It is not your .htaccess. The problem was simply in folder permissions. Windows is a bit more flexible when it comes to permissions. With Ubuntu, and Linux in general you have to be a bit more careful and explicit.

Run the following commands through terminal.

sudo chmod -R 755 laravel_blog

and then type below to allow Laravel to write file to storage folder

chmod -R o+w laravel_blog/storage

These two commands will solve the problem.

About the author

laravelrecipies