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?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3fKONkN
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

5 Free Black and White Social Media Icons Sets with CSS and HTML

How to Create Treeview with Bootstrap and jQuery

How to Change Apache and MySQL Port Number in XAMPP Localhost