Aaron Crosman on 26 Jul 2006 17:15:41 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

RE: [PLUG] PHP Mime detection


> First, run file on the file in question.  If file also thinks 
> it's text/plain, then either the mp3 is busted, or you are 
> overriding mime types somewhere.
> 
> To see if you're overriding mime types somewhere, strace it, 
> and look for what it opens, to see if the default mime 
> handling is getting overridden anywhere.
> 
> strace -ff -e open php tmp.php
> (where tmp.php is your script above)
> 
> You will get a bunch of of lines like:
> open("/etc/ld.so.cache", O_RDONLY)      = 3
> open("/lib/tls/i686/cmov/libnss_files.so.2", O_RDONLY) = 3
> open("/etc/protocols", O_RDONLY)        = 3
> open("/etc/protocols", O_RDONLY)        = 3
> open("/usr/share/file/magic.mime", O_RDONLY) = 3
> 
> That last one is the important one here - if you have others, 
> you'll want to see if they accidentally or purposely override 
> what's set in that file.
> 
> If you're not overriding mime types, then the file is likely busted.
> Does it actually have the magic bits at the beginning?  The 
> first one I looked at has 'ID3' as the first 3 characters of 
> the file, which agrees with the above file magic.
> 
> Take care,
> --

I didn't occure to me that I might have been provided with 20 MP3 files
that were not encoded right.  That seems to be it.  They are missing the
ID3 at the start.  Now I just need to sort out what we're going to do
about that.

Thanks for the tip
Aaron
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug