mardi 13 mars 2018

Laravel file cannot be deleted

I am trying to delete a file (a temporary file that I create if my import command fails), which is located under storage/framework/cache/.
I tried to use unlink but always I get an error Text file busy (as I searched, this error is displayed because the file is in use).
I tried also File::delete($fullpath) but doesn't work too (no error, but the file is not removed)
The problem is if I check if the file exists, it is always true (I checked also manually and the file is there).
Here what I made:

$lockfilePath = $this->lockFilePath($uri);// if i display this line, I get /var/www/html/project/storage/framework/cache/filename.lock
if (!file_exists($lockfilePath)) {
    throw new RuntimeException("$uri was not locked. Lockfile not found.");
}
\File::delete($lockfilePath); // I tried also unlink($lockfilePath);

I am working with homestead and Laravel 5.1 (PHP version 5.6).



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire