一,报错信息:
laravel在安装完成后初次运行时会报错,
Internal Server Error
Illuminate\Database\QueryException
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
(Connection: sqlite, SQL: update "sessions" set "payload" =
YTozOntzOjY6Il90b2tlbiI7czo0MDoiclNUOVV5VlJRcEljckJpWWU1R2VCUjI5SDNiZnE0ODlCem91NGd1QSI7czo5
OiJfcHJldmlvdXMiO2E6MTp7czozOiJ1cmwiO3M6MTg6Imh0dHA6Ly84LjE0MC4xNy41NyI7fXM6NjoiX2ZsYXNoIjth
OjI6e3M6Mzoib2xkIjthOjA6e31zOjM6Im5ldyI7YTowOnt9fX0=, "last_activity" = 1720601003,
"user_id" = ?, "ip_address" = 123.112.208.148,
"user_agent" = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36,
"id" = JeuwWygSuFZEhH0oKSLiYbVijRgtYGA6l4j0REbe
where "id" = JeuwWygSuFZEhH0oKSLiYbVijRgtYGA6l4j0REbe)
如图:
二,问题原因:
laravel默认使用database作为session的存储,
所以需要配置数据库使laravel能够连接,
例:在.env中
SESSION_DRIVER=database
三,解决:
如果不想连接数据库,可以配置session使用文件存储
[root@blog proj]# vi .env
设置SESSION_DRIVER的值为file即可
SESSION_DRIVER=file
修改后刷新页面可以看到页面恢复正常
标签:laravel,SESSION,database,完后,DRIVER,session,id From: https://www.cnblogs.com/architectforest/p/18294535