When working with file operations in PHP, you may encounter the error message “file_put_contents: Failed to open stream, no such file or directory.” This error typically occurs when PHP is unable to find or create the specified file or directory during a file write operation using the file_put_contents()
function. Below, we’ll explore common causes of this error and provide solutions to resolve it.

Run Command:-
php artisan optimize
php artisan key:gen
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan storage:link

Hopefully, It will help you…!!!