Mohammad hayajneh
Mohammad hayajneh

Reputation: 674

file_put_contents(C:\storage\framework\views/27f511f5644086daa68b2cf835bf49f5148aba43.php): failed to open stream: No such file or directory

so i keep getting this error on my live server but not on my local host, everything works normal on my localhost but when i deploy my website on online server it keep giving me this error

file_put_contents(C:\appname\storage\framework\views/27f511f5644086daa68b2cf835bf49f5148aba43.php): failed to open stream: No such file or directory

i tried php artisan config:cache but nothing really worked

Upvotes: 2

Views: 6055

Answers (5)

Zahid
Zahid

Reputation: 614

I solved with these commands:

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

Upvotes: 0

Elisha Senoo
Elisha Senoo

Reputation: 3594

I suppose your issue is due to the Laravel Configuration Caching.I suggest you

  1. Remove the configuration cache file
  2. Flush the application cache
  3. Create a cache file for faster configuration loading

To do this, run the following Artisan commands on your command line

  1. php artisan config:clear
  2. php artisan cache:clear
  3. php artisan config:cache

Where you don't have access to the command line on your server, you can programmatically execute commands like this:

Route::get('/clear-cache', function() {
    $exitCode = Artisan::call('config:clear');
    $exitCode = Artisan::call('cache:clear');
    $exitCode = Artisan::call('config:cache');
    return 'DONE'; //Return anything
});

I hope this is helpful.

Upvotes: 3

tintinboss
tintinboss

Reputation: 672

Looks like your storage/ directory is not writable. Laravel requires that directory to be writable.

If you're on linux/mac, run this

chmod 0755 storage/ -R

Hope that helps.

Upvotes: 0

Exit
Exit

Reputation: 993

I'm going to guess that you have the wrong path being used, so try this to ensure that regardless of the server, you will have the right path:

$path = dirname(__FILE__);
file_put_contents($path.DIRECTORY_SEPARATOR.'27f511f5644086daa68b2cf835bf49f5148aba43.php');

This assumes that you are trying to write to the same folder as the code file that is running this.

You can also use the following to determine exactly what the path is on each server:

echo getcwd();

Upvotes: 0

dmitri
dmitri

Reputation: 469

Try and use next command "php artisan cache:clear" will help you to clear cache for app

Upvotes: -1

Related Questions