"Could Not Open" errors

The place for "I can't figure out how to..." questions.
Post Reply
fpolli
User
Posts: 4
Joined: Fri Nov 02, 2018 11:57 am
Are you a spambot?: no

"Could Not Open" errors

Post by fpolli » Fri Nov 02, 2018 12:17 pm

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.

James Heinrich
getID3() v1 developer
Posts: 1474
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: "Could Not Open" errors

Post by James Heinrich » Fri Nov 02, 2018 2:15 pm

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

fpolli
User
Posts: 4
Joined: Fri Nov 02, 2018 11:57 am
Are you a spambot?: no

Re: "Could Not Open" errors

Post by fpolli » Fri Nov 02, 2018 3:08 pm

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?

James Heinrich
getID3() v1 developer
Posts: 1474
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: "Could Not Open" errors

Post by James Heinrich » Fri Nov 02, 2018 3:27 pm

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";
  }
}

fpolli
User
Posts: 4
Joined: Fri Nov 02, 2018 11:57 am
Are you a spambot?: no

Re: "Could Not Open" errors

Post by fpolli » Fri Nov 02, 2018 3:31 pm

Thank you, I will try that.

fpolli
User
Posts: 4
Joined: Fri Nov 02, 2018 11:57 am
Are you a spambot?: no

Re: "Could Not Open" errors

Post by fpolli » Fri Nov 02, 2018 7:06 pm

Thank you. The files passed that test but you led me in the right direction in troubleshooting, and I got it working.

James Heinrich
getID3() v1 developer
Posts: 1474
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: "Could Not Open" errors

Post by James Heinrich » Fri Nov 02, 2018 7:34 pm

Excellent. Out of curiosity (and in case someone else has a similar problem), would you mind describing the solution you found?

Post Reply