Magento2: Warning: is_file() expects parameter 1 to be a valid path

Created on 13 Sep 2017  路  26Comments  路  Source: magento/magento2

Preconditions

  1. Ubuntu 16.04
  2. PHP 7.0.22

Steps to reproduce

  1. run module:enable or module:disable

Expected result

  1. do not expect any warnings

Actual result

  1. [Exception]
    Warning: is_file() expects parameter 1 to be a valid path, string given in
    /home/user/web/some_site.com/public_html/vendor/colinmollenhour/cache-backend
    -file/File.php on line 512

Additional

when try to debug found that exception is thought for this path /home/user/web/some_site.com/public_html/var/cache/mage--a/mage---966_CRON_LAST_SCHEDULE_GENERATE_ATDEFAULT

Format is valid needs update

Most helpful comment

I have solved it by removing the cache:

rm -rf var/cache var/log var/page_cache var/view_preprocessed

All 26 comments

After manual cache clearing bug is go out

@webmak , thank you for your report. Please specify the exact version of Magento or the tagged build you installed.

@webmak we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

Same problem here.
"FLUSH MAGENTO CACHE" throws this exception in admin.
Magento just updated yesterday (11 Oct 2017) to latest patched Version 2.1.9 with Setup Wizard/System Upgrade

The problem is for some reason that the string length is really big but the string itself is not.
If you do a var_dump of the $idFile in File.php of the function _cleanNew you will see that the string length does not match the actual length

string(100) "/data/sites/web/***/www/var/cache/mage--8/mage---355_SYSTEM_STORESNL"

replaced a the domain with * for security reasons

switching from PHP 7.0 to 7.1 made my stringlength smaller (used to have strings over 700 length) but still not matching the actual string length. Because the length is not matching the file path length it returns false. Just deleting filles is a temp fix (really temp)

re-open please

same issue

I solved this problem by talking to my hosting company who has resolved this by making changes in the fille permissions. So anyone who has this issue i highly recommend to check fille permissions

@versdivers do you know what they changed the permissions _from_ and _to_? I have a similar error, same file too. But my permissions were set per the docs and everything else is working. In the stack trace i don't see anything about permissions. I posted another thread here.

I have solved it by removing the cache:

rm -rf var/cache var/log var/page_cache var/view_preprocessed

Same issue 2.2.0 after clearing cache it's gone

@jtlindsey I'm not sure what they changed. I changed host by now so i can' tell anymore i'm sorry

@versdivers No problem. It only happens for me after running bin/magento setup:upgrade or bin/magento setup:di:compile. I run chown -R :www-data var/cache/mage-tags/ to resolve.

@dmitry-fedyuk 's fix worked for me. Just remove cache:
rm -rf var/cache var/log var/page_cache var/view_preprocessed

Thank you @dmitry-fedyuk!

Delete Manual var/cache folder, and apply php bin/magento setup:di:compile command

at terminal you should apply following command
rm -rf var/cache var/log var/page_cache var/view_preprocessed

same issue on Magneto 2.2.7 on fresh install, cache flush works a charm

same issue on Magneto 2.2.7 on fresh install, cache flush works a charm

at terminal you should apply following command
rm -rf var/cache var/log var/page_cache var/view_preprocessed

Actually you run

bin/magento cache:flush

This is more than suffice to get it working

what about magento enterprise 1.14 ? on web/lib/Varien/Io/File.php line 535?

What could be causing it ?
Warning: is_readable() expects parameter 1 to be a valid path, string given in

what about magento enterprise 1.14 ? on web/lib/Varien/Io/File.php line 535?

What could be causing it ?
Warning: is_readable() expects parameter 1 to be a valid path, string given in

can you please check this below?

Delete Manual var/cache folder, and apply php bin/magento setup:di:compile command

@maneza f8

what about magento enterprise 1.14 ? on web/lib/Varien/Io/File.php line 535?
What could be causing it ?
Warning: is_readable() expects parameter 1 to be a valid path, string given in

can you please check this below?

Delete Manual var/cache folder, and apply php bin/magento setup:di:compile command

@maneza f8

Well as I mentioned I am asking in which regard to Magento enterprise 1.14 and deleting cache doesn't work on my situation.

what about magento enterprise 1.14 ? on web/lib/Varien/Io/File.php line 535?
What could be causing it ?
Warning: is_readable() expects parameter 1 to be a valid path, string given in

can you please check this below?
Delete Manual var/cache folder, and apply php bin/magento setup:di:compile command
@maneza f8

Well as I mentioned I am asking in which regard to Magento enterprise 1.14 and deleting cache doesn't work on my situation.

then please check php version. It is problem of php version

ooh okay can you elaborate more on that?

cache:flush
this was the only method that worked for me

cache:flush
this was the only method that worked for me

I am asking this for magento one I did flush cache many times from the backend but that has never worked I had this warning on my logs for over 4 years now.

@manezaf8 perhaps is better to post this issue in a magento ver 1 forum as a new request? For magento two you could try to manually delete the cache? sorry my knowledge of magento is at its limit!

Was this page helpful?
0 / 5 - 0 ratings