How to Setup File Permission for Laravel Framework (Best Practise)

Linux server permission best practice for Laravel framework everyone should know.

Eddy Goh
4 min readNov 11, 2021
Laravel file permission best practice. Learnt the best know method to setup the permission in Linux for Laravel framework.
Source: Author

If you found this article, most probably you have searched the internet for a guide on how to set up Laravel framework file permission properly. You are in luck! But before we begin, below are the most common permission related error faced by Laravel framework users:

  • Laravel permission denied
    [ErrorException] file_put_contents(/opt/bitnami/apache/htdocs/vendor/composer/installed.php) : failed to open stream: Permission denied
  • Works today after fixing the permission, but it happens again the next day due to the daily log created with the wrong permission.
  • Cronjob related permission error
  • Composer permission error
    [RuntimeException] Error Output: PHP Warning: required(../vendor/autoload.php): failed to open stream: no such file or directory
  • NPM permission error
    npm WARN checkPermissions Missing write access to /opt/bitnami/apache/htdocs/node_modules
  • Warning due to running Composer as root
    Do not run Composer as root/super user! See https://getcomposer.org/root for details.

--

--

Eddy Goh
Eddy Goh

Written by Eddy Goh

Entrepreneur in Tech since 2008 | Leading web3, mobile apps, system, 3D & games development | Top Writer in💻Technology |🥇Top Medium Writer | CTO