Page 1 of 3

cache error file not found

Posted: Wed Jan 03, 2018 9:47 pm
by Evilonion
Warning: unlink(/var/sites/f/website.co.uk/storage/cache/cache.catalog.language.1514990162): No such file or directory in /var/sites/f/website.co.uk/public_html/newshop/system/library/cache/file.php on line 68

this is whats on line 68: unlink($file);

Any ideas how i can fix this?
Its filling up the error logs.

Everything seems to be set correctly in the config files after moving the storage folder so unsure what to do next?

Re: cache error file not found

Posted: Thu Jan 04, 2018 1:22 am
by D3MO
To me it looks like permission issue but reversed , when system not able to create cached file but since it had to create it tries to delete and do not finds it

Re: cache error file not found

Posted: Thu Jan 04, 2018 8:10 am
by straightlight
Seem also to me that the library cache file may need to be replaced and also to clear your OC cache from the admin once the file being replaced. Replace your system/library/cache/file.php file with the following noticing if it will rectify the issue: https://github.com/opencart/opencart/bl ... e/file.php

Re: cache error file not found

Posted: Thu Jan 04, 2018 7:57 pm
by Evilonion
This appears to have cleared the error from appearing thank you.
Will update if i see it again.

Re: [solved] cache error file not found

Posted: Fri Jan 05, 2018 10:20 pm
by Evilonion
Still receiving error in Logs and it occasionally comes up on the front end as an error message across the screen.
Firstly, any ideas how to fix? and secondly is there a way to stop these messages showing to customers?

2018-01-05 14:00:33 - PHP Warning: unlink(/var/sites/f/website.co.uk/storage/cache/cache.catalog.language.1515164407): No such file or directory in /var/sites/f/website.co.uk/public_html/system/library/cache/file.php on line 44

Also:


2018-01-05 11:41:55 - PHP Warning: unlink(/var/sites/f/firesidefabrics.co.uk/storage/cache/cache.manufacturer.0.1515152492): No such file or directory in /var/sites/f/firesidefabrics.co.uk/public_html/system/library/cache/file.php on line 44


Error logs are absolutely full of these errors constantly repeating

Re: cache error file not found

Posted: Sat Jan 06, 2018 6:30 am
by straightlight
Now that you've replaced the cache library file, clear your OC admin dashboard cache as well from your admin - > extensions - > modifications - > refresh button. Does the error log keep increasing afterwards?

Re: cache error file not found

Posted: Sat Jan 06, 2018 8:19 pm
by Evilonion
error still persists.
error message that occasionally pops up in admin above that error is "syntax error: unexpected token < in JSON at position 0

OK

unlink(/var/sites/f/website.co.uk/storage/cache/cache.catalog.language.1515230665): No such file or directory in /var/sites/f/website.co.uk/public_html/system/library/cache/file.php on line 44

Re: cache error file not found

Posted: Sat Jan 06, 2018 10:03 pm
by straightlight
error message that occasionally pops up in admin above that error is "syntax error: unexpected token < in JSON at position 0
Where in the admin do you see this message and how?

Re: cache error file not found

Posted: Sun Jan 07, 2018 9:32 pm
by Evilonion
this particular message popped up when editing an order.

the php error however shows up all over the place in admin in various places such as editing products, adding products, viewing products on the main site all sorts. seems to be a continuous error with that particular file.php

Re: cache error file not found

Posted: Sun Jan 07, 2018 9:41 pm
by straightlight
If you add the following line in your system/library/cache/file.php after the <?php line:

Code: Select all

echo 'test123';
do you see the line added on the top of your browser after saving the file?

Re: cache error file not found

Posted: Mon Jan 08, 2018 1:43 am
by Evilonion
instantly throws up an error and both admin and storefront don't load:

Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in /var/sites/f/website.co.uk/public_html/system/library/cache/file.php on line 3

removed that line you said and when i click on dashboard i got this error:

SyntaxError: JSON Parse error: Unrecognized token '<'
OK
<b>Warning</b>: unlink(/var/sites/f/website.co.uk/storage/cache/cache.manufacturer.0.1515346921): No such file or directory in <b>/var/sites/f/website.co.uk/public_html/system/library/cache/file.php</b> on line <b>44</b>{"ie":{"total":"1","amount":"\u00a374.00"},"gb":{"total":"10","amount":"\u00a397.04"}}

Re: cache error file not found

Posted: Mon Jan 08, 2018 8:30 pm
by ADD Creative
You can switch off the displaying of errors by going to System -> Settings -> Edit (for your store) in the Admin. Then on the Server tab set Display Errors to No and save. This will stop the errors from showing on pages (and causing other errors), but they will still be logged.

When you see the errors have you check that the file it's trying to delete is actually deleted?

Re: cache error file not found

Posted: Mon Jan 08, 2018 8:52 pm
by Evilonion
i have the error notification switched off but the error that still shows is a pop up that the user has to click ok to close.

as for the file, i don't know what file its trying to delete?

Re: cache error file not found

Posted: Tue Jan 09, 2018 2:58 am
by ADD Creative
The files being deleted are in brackets after unlink in your error messages.

For example in the last error message you posted.

Code: Select all

<b>Warning</b>: unlink(/var/sites/f/website.co.uk/storage/cache/cache.manufacturer.0.1515346921): No such file or directory in <b>/var/sites/f/website.co.uk/public_html/system/library/cache/file.php</b> on line <b>44</b>
/var/sites/f/website.co.uk/storage/cache/cache.manufacturer.0.1515346921 is the file being deleted.

Regarding the displaying of errors. It seems that version 3 has an seperate default error handler. To switch this off change $_['error_display'] to false in system\config\default.php or add

Code: Select all

$_['error_display']        = false;
to system\config\catalog.php and system\config\admin.php

Re: cache error file not found

Posted: Tue Jan 09, 2018 7:29 am
by straightlight
This ongoing issue has been posted on Github yesterday. Thank you.

Re: cache error file not found

Posted: Tue Jan 09, 2018 7:52 am
by Evilonion
the file in the brackets doesn't exist. the one that does is: cache.manufacturer.0.1515457091
slightly different numbers...


And the language file is: cache.catalog.language.1515458969

Re: cache error file not found

Posted: Tue Jan 09, 2018 9:00 pm
by ADD Creative
That shows that the file is being deleted correctly. Once you have switched off display errors, to stop your log files filling up you could change the following in system/library/cache/file.php.

Code: Select all

if (file_exists($file)) {
	unlink($file);
}
To

Code: Select all

if (is_file($file)) {
	@unlink($file);
}
This won't help help solve the root cause of the problem of why you see so many race conditions in deleting the cache files.

Re: cache error file not found

Posted: Wed Jan 10, 2018 1:58 am
by Evilonion
I thought id try turning off cache to see what happens.

Warning: fopen(/var/sites/f/website.co.uk/storage/logs/): failed to open stream: Is a directory in /var/sites/f/website.co.uk/public_html/system/library/log.php on line 22
That appeared once and haven't been able to see it again.

Im getting loads of this unlink error though, every file it refers to doesn't even exist.
I don't really want to hide it from the logs as id be unsure if it was still happening then...

Re: cache error file not found

Posted: Wed Jan 10, 2018 2:45 am
by ADD Creative
What is usually happening in this case is another process has deleted the cache file between the file_exists($file) check and the unlink($file). So there ends up being no file for unlink($file) to delete, giving the error message. You could try clearing the file status cache instead of suppressing the error.

system/library/cache/file.php.

Code: Select all

if (file_exists($file)) {
	unlink($file);
}
Change to

Code: Select all

clearstatcache(false, $file);

if (is_file($file)) {
	unlink($file);
}

Re: cache error file not found

Posted: Wed Jan 10, 2018 8:17 am
by rokonkwo
It did not work. Is there any solution to this error?