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

moh120's avatar

Uncaught ErrorException: file_put_contents

Uncaught ErrorException: file_put_contents(C:\Users\4th\Documents\RadSystems\PHPRad Classic Projects\menacatalyst\storage\framework\views/1ed4160b40f124b0778225569ed8d810eb1b61b2.php): failed to open stream: No such file or directory in C:\xampp\htdocs\menacatalyst\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:135

0 likes
1 reply
LaryAI's avatar
Level 58

The error message suggests that the file_put_contents function is unable to create a file because the directory does not exist.

To solve this issue, you can try creating the missing directory manually or by using the makeDirectory method provided by Laravel's Filesystem class.

Here's an example of how to create the directory using the makeDirectory method:

use Illuminate\Support\Facades\File;

$path = storage_path('framework/views');

if (!File::exists($path)) {
    File::makeDirectory($path, 0755, true);
}

This code checks if the directory exists and creates it if it doesn't. The third parameter of the makeDirectory method specifies whether to create any missing parent directories as well.

You can place this code in a service provider's boot method or in a middleware that runs before the view is rendered.

Please or to participate in this conversation.