วันเสาร์ที่ 11 มีนาคม พ.ศ. 2560

Laravel Internal Error 500 caused by permission in a linux system.

Although Laravel has a "Whoops" screen to show an error log helping developers to easily identify problems in their coding line by line, what if they do when a HTTP error is shown instead. This problem should be likely to happen when migrating project into a Linux system with an old traditional way.

Think of situation when you are working with a shared Linux hosting. All you have been grant is only a FTP to transfer web stuffs. Mean that composer won't be available to use anymore. Now, all of stuffs are uploaded to a Web server. First time you surf into any of path of a project, the "HTTP 500 Internal Server Error" may show out to the screen with no clues.

A web browser shows that HTTP ERROR 500 message.


This problem is caused by permission issue that should be set properly to the folder.
In an example, a Laravel version is 5.4 (which is the newest for now).
From root folder, look for a Storage folder. It is a logged files folder. With a default permission set of value, a web server is not be able to write errors in it. To fix this issue you have to manually give permissions for the group as 777 to /storage/framework/sessions and /storage/logs so both your login user and web server user can write to that log in the folders.

A big thanks to
http://stackoverflow.com/questions/23540083/failed-to-open-stream-permission-denied-error-laravel