|

Permissions for running Laravel 11 on Apache2 server

The php artisan serve makes our life easy but what if you are running its app on the Apache web server? Laravel 11 is new, and it brings us many new features. You may face some errors so, please keep these solutions in mind.

To write all logs

sudo chown www-data:www-data storage/logs/

To store views in cache
sudo chown www-data:www-data storage/framework/views/

To save application’s and user’s data in SQLite database

sudo chown www-data:www-data database/database.sqlite

To validate CSRF token if the SESSION_DRIVER value is database which is default setting in Lavavel 11 or you will experience error 419 | Page Expired
sudo chown www-data:www-data database/

To cache laravel’s system files for optimization

sudo chown www-data:www-data bootstrap/cache

If you have the Queue Worker for Sending Emails or any other case that involve your user account then better add your user account in the www-data group by following command.

sudo usermod -aG www-data $USER

To allow your worker to create email views from your user account, add all permission to the goup as well otherwise the job will be failed.

sudo chmod 775 storage/framework/views/

Similar Posts

Leave a Reply