Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

EckyEckyPtang's avatar

ErrorException in Filesystem.php line 81: file_put_contents(fe54ef3ba9c3fcf41d5623af48edf9aafda06f1f.php): failed to open stream: Permission denied

Edit:had to remove the / in the title because the forum formatted it wrong.

ErrorException in Filesystem.php line 81: file_put_contents(/fe54ef3ba9c3fcf41d5623af48edf9aafda06f1f.php): failed to open stream: Permission denied

The storage folder is writable and so is the cache folder. But I keep getting this error. Why is laravel trying to write to this file: /fe54ef3ba9c3fcf41d5623af48edf9aafda06f1f.php ?

It may have something to do with the directory structure of the deployed app. Laravel is uploaded in /home/me/laravel/ (outside the public dir) The public files are uploaded in /home/me/public_html/

So the path in autoload.php is updated to reflect this.

Does anyone know what is going on here?

Grtz

0 likes
5 replies
d3xt3r's avatar

Can you show the full error trace as to where its happening ?

EckyEckyPtang's avatar

@premsaurav I scrolled down to the bottom and there was another error:

ErrorException in Filesystem.php line 81:
file_put_contents(/home/me/laravel/storage/framework/sessions/158862b80c5a97fa0fa47c626842e76d75f4eaf6): failed to open stream: No such file or directory
in Filesystem.php line 81
at HandleExceptions->handleError('2', 'file_put_contents(/home/me/laravel/storage/framework/sessions/158862b80c5a97fa0fa47c626842e76d75f4eaf6): failed to open stream: No such file or directory', '/home/me/laravel/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', '81', array('path' => '/home/me/laravel/storage/framework/sessions/158862b80c5a97fa0fa47c626842e76d75f4eaf6', 'contents' => 'a:5:{s:6:"_token";s:40:"fnnfkpg0wPnr78Ygb8iUleobXCBphnEvGDeu423A";s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:26:"http://X.com/landing";}s:9:"_sf2_meta";a:3:{s:1:"u";i:1454597011;s:1:"c";i:1454597011;s:1:"l";s:1:"0";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', 'lock' => true))
at file_put_contents('/home/me/laravel/storage/framework/sessions/158862b80c5a97fa0faa47c626842e76d75f4eaf6', 'a:5:{s:6:"_token";s:40:"fnnfkpg0wPnr78Ygb8iUleobXCBphnEvGDeu423A";s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:26:"http://X.com/landing";}s:9:"_sf2_meta";a:3:{s:1:"u";i:1454597011;s:1:"c";i:1454597011;s:1:"l";s:1:"0";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', '2') in Filesystem.php line 81
at Filesystem->put('/home/me/laravel/storage/framework/sessions/158862b80c5a97fa0fa47c626842e76d75f4eaf6', 'a:5:{s:6:"_token";s:40:"fnnfkpg0wPnr78Ygb8iUleobXCBphnEvGDeu423A";s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:26:"http://X.com/landing";}s:9:"_sf2_meta";a:3:{s:1:"u";i:1454597011;s:1:"c";i:1454597011;s:1:"l";s:1:"0";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}', true) in FileSessionHandler.php line 71
at FileSessionHandler->write('158862b80c5a97fa0fa47c626842e76d75f4eaf6', 'a:5:{s:6:"_token";s:40:"fnnfkpg0wPnr78Ygb8iUleobXCBphnEvGDeu423A";s:22:"PHPDEBUGBAR_STACK_DATA";a:0:{}s:9:"_previous";a:1:{s:3:"url";s:26:"http://X.com/landing";}s:9:"_sf2_meta";a:3:{s:1:"u";i:1454597011;s:1:"c";i:1454597011;s:1:"l";s:1:"0";}s:5:"flash";a:2:{s:3:"old";a:0:{}s:3:"new";a:0:{}}}') in Store.php line 262
at Store->save() in StartSession.php line 88
at StartSession->terminate(object(Request), object(Response)) in Kernel.php line 155
at Kernel->terminate(object(Request), object(Response)) in index.php line 57 ```
d3xt3r's avatar
file_put_contents(/home/me/laravel/storage/framework/sessions/158862b80c5a97fa0fa47c626842e76d75f4eaf6): failed to open stream: No such file or directory

These are default folders, did you remove them and whether they have permission ?

EckyEckyPtang's avatar

@premsaurav Yes I already mentioned, the storage folder (and all of its subfolders) have 777 permissions. I also tried to remove and recreate the storage folder.

The question is why Laravel is trying to access this file: file_put_contents(/fe54ef3ba9c3fcf41d5623af48edf9aafda06f1f.php)

This seems like something that belongs in the storage folder, but the path passed to file_put_contents is not the storage directory.

d3xt3r's avatar

Just for this i asked for the full error trace, so that could figure out whats going on ? Can you provide it so I can try ?

Please or to participate in this conversation.