3

I have a file on a network shared location, and I want to check if it exists programmatically with PHP.

When running from PhpUnit, it works fine. My minimal test is:

public function testBackupFileExists () {
  $backup_pname = 'R:\myFolder\mySubFolder\myFile.csv';
  $this->assertTrue (file_exists ($backup_pname), "File $backup_pname not found");
}

When running from a web interface, from my localhost, file_exists() returns false...

They both use the same version of PHP (7.4.1) and are both executed from the same machine. I also tried running clearstatcache(), but it doesn't work.

Brainless
  • 1,522
  • 1
  • 16
  • 30
  • Hasn't safe mode been removed since version 5.4.0? https://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-include-dir – Brainless Feb 21 '20 at 10:45
  • Ops yes its sorry didnt see that! https://www.php.net/manual/en/features.safe-mode.php –  Feb 21 '20 at 10:49

0 Answers0