0

I'm having troubles with file_exists, it returns false despite that file exists, or checking it with string.

$path = $_SERVER['DOCUMENT_ROOT'].$linkImageFull;
var_dump($path, file_exists($path), file_exists('/var/www/app/web/images/krzeselko-bespoke-synergy_main.jpg'));

gives result

string(36) "/var/www/app/web/images/krzeselko-bespoke-synergy_main.jpg"
bool(false)
bool(true)

clearstatcache() does not help.

  • May be a duplicate of https://stackoverflow.com/questions/6930150/file-exists-returns-false-but-the-file-does-exist, please check. – Nigel Ren Apr 29 '21 at 10:22
  • 4
    Something must be off, `/var/www/app/web/images/krzeselko-bespoke-synergy_main.jpg` is 58 characters long by my count, yet your debug output says the length of this string was 36? – CBroe Apr 29 '21 at 10:23
  • This website is oldschool using some odd templating system, and file_exists is used through that template system. I've moved this part of code outside templating system and it works fine now, thank you for pointing me in right direction. – Jakub Skąpski Apr 29 '21 at 10:37

0 Answers0