Laravel 11 - Sqlite attempt to write a readonly database

Date : 16-07-2024

Suppose your database is located at /var/www/html/myapp/database/database.sqlite. Here is a consolidated approach:

  1. Set Permissions:
bash
Copy code
sudo chown www-data:www-data /var/www/html/myapp/database/database.sqlite
sudo chmod 664 /var/www/html/myapp/database/database.sqlite
sudo chown -R www-data:www-data /var/www/html/myapp/database
sudo chmod -R 775 /var/www/html/myapp/database
  1. Configure .env File:
dotenv
Copy code
DB_CONNECTION=sqlite
DB_DATABASE=/var/www/html/myapp/database/database.sqlite
  1. Clear Laravel Cache:
bash
Copy code
php artisan config:clear
php artisan cache:clear
php artisan config:cache