lundi 9 août 2021

Why have to disconnect the sqlite database when deleting the sqlite file on the local server storage?

I want to delete the sqlite file that is on the local server storage after the file is uploaded to AWS S3. But I'm having Resource temporarily unavailable error.

unlink(storage_path('app/public/' . $sqliteFileName));

So I thought to disconnect the database first before deleting the sqlite file. And it worked without getting the previous error.

DB::disconnect('sqlite_db'); 
unlink(storage_path('app/public/' . $sqliteFileName));

I'm using this code with Laravel API v.5.6 and sqlite v.3.x. Do you know the reason why disconnecting this database solved the problem?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire