1
votes

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

4
Looks like you are using the wrong path. Does the server actually have this path `C:\appname\storage\framework\views"? - Exit
Is your live server a windows or Unix server? If its unix this C:\appname\storage\framework\views defintely does not exist - RiggsFolly
@Exit no i changed it for this question - Mohammad hayajneh
@RiggsFolly Unix and i changed it for this question - Mohammad hayajneh
Then C: is not a Unix concept. there are no drives in Unix the disk storage all hangs of a logical root folder. You cannot write Windows specific code and expect it to run on Unix - RiggsFolly

4 Answers

2
votes

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.

0
votes

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();
0
votes

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.

-1
votes

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