0
votes

I am facing issues, while consuming API in Laravel. Below is error:

at HandleExceptions->handleError(2, 'file_put_contents(/var/www/html/trazoo/storage/framework/cache/data/cb/f4/cbf4899d461098a11f02d3b4c1bdbcf7d6c3a5d5): failed to open stream: No such file or directory', '/var/www/html/trazoo/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', 122, array('path' => '/var/www/html/trazoo/storage/framework/cache/data/cb/f4/cbf4899d461098a11f02d3b4c1bdbcf7d6c3a5d5', 'contents' => '1578913060i:0;', 'lock' => true)) at file_put_contents('/var/www/html/trazoo/storage/framework/cache/data/cb/f4/cbf4899d461098a11f02d3b4c1bdbcf7d6c3a5d5', '1578913060i:0;', 2) in Filesystem.php line 122 at Filesystem->put('/var/www/html/trazoo/storage/framework/cache/data/cb/f4/cbf4899d461098a11f02d3b4c1bdbcf7d6c3a5d5', '1578913060i:0;', true) in FileStore.php line 66

But there are lots of folders inside cache/data .. but not this "f4".

Also in FileSystem.php

public function put($path, $contents, $lock = false)
{
    return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
}

Dont know what this LOCK_EX means. Is this creating any issue, i have no idea.

So can any one please suggest, where is the issue.

Thanks

1

1 Answers

0
votes

The folder might not be writeable, check for permissions on the cache folder. File put contents may create the file and will need permission to do that. https://www.php.net/manual/en/function.file-put-contents.php

from doc: If filename does not exist, the file is created. Otherwise, the existing file is overwritten, unless the FILE_APPEND flag is set.

also helpful : How to set up file permissions for Laravel?