Page 1 of 1

"Could Not Open" errors

Posted: Fri Nov 02, 2018 12:17 pm
by fpolli
I am using version 1.9.16-201810301750
Apache server, php 7
Trying to read jpgs in a folder and for every single jpg in the folder I get "Could not open "myfile.jpg" (!is_readable; !is_file; !file_exists)".
I have tried on my local development server and on the production server, same results. Interestingly enough, on my local server it was able to read the .DS_STORE file.
I have checked all the folders and the files for permissions. The folders are all 755 and the files are all 644. The server is able to serve the images.

I will provide any other information you need.

Thank you.

Re: "Could Not Open" errors

Posted: Fri Nov 02, 2018 2:15 pm
by James Heinrich
This is a PHP / OS / permissions issue, nothing specific to getID3.
Check OS user/file permissions
Check PHP/Apache restrictive settings such as safe_mode, open_basedir, etc

Re: "Could Not Open" errors

Posted: Fri Nov 02, 2018 3:08 pm
by fpolli
So it's a PHP/OS/permissions issue that literally affects nothing BUT getID3. I gave you the permissions. The files are 644 and folders 755, so how should that prevent getID3 from opening the files? I'm passing complete paths. Apache is not in safe mode, and from my reading of open_basedir, it should not apply when a full path is given. And, as I said, the script is able to open the .DS_STORE file, which has the same owner/permissions as all the jpgs in the folder.

So, if my other PHP scripts are able to serve those files, and getID3 is able to open the .DS_STORE file in the same folder with the same owner/permissions, any more specific idea than "check OS user/file permissions" and "restrictive settings" as to why that might be?

Re: "Could Not Open" errors

Posted: Fri Nov 02, 2018 3:27 pm
by James Heinrich
fpolli wrote:
Fri Nov 02, 2018 3:08 pm
from my reading of open_basedir, it should not apply when a full path is given
open_basedir, if enabled, always applies: it's a security configuration to prevent unwanted access outside the listed directories.

You could try a quick little test like this to run through the directory in question and see what PHP (totally unrelated to getID3) says about those files:

Code: Select all

$dir = '/path/to/files';
if ($dh = opendir($dir)) {
  while ($file = readdir($dh)) {
    $filename = realpath($dir.'/'.$file);
    echo '('.(is_file($filename) ? '' : 'NOT ').'file) ('.(is_readable($filename) ? '' : 'NOT ').'readable) ('.(file_exists($filename) ? '' : 'NOT ').'exists) = '.$filename'."\n";
  }
}

Re: "Could Not Open" errors

Posted: Fri Nov 02, 2018 3:31 pm
by fpolli
Thank you, I will try that.

Re: "Could Not Open" errors

Posted: Fri Nov 02, 2018 7:06 pm
by fpolli
Thank you. The files passed that test but you led me in the right direction in troubleshooting, and I got it working.

Re: "Could Not Open" errors

Posted: Fri Nov 02, 2018 7:34 pm
by James Heinrich
Excellent. Out of curiosity (and in case someone else has a similar problem), would you mind describing the solution you found?