We were called in to help someone with a failing file upload feature on a PHP website.
It turned out that we’d recently upgraded their server to debian 5.0 and the mime_content_type() PHP function was no longer available.
This isn’t a serious bug really, because the function has been deprecated (old PHP lives forever, but not so function definitions) for some time. Debian bug #491033 gives the details.
We put together a fairly quick fix using shell_exec() to call the file command (with the usual checks to avoid someone poisoning the shell – which shouldn’t happen because it’s only called on uploaded temporary filenames, but why risk it?). We could have used finfo_file but that’s not yet packaged for debian, so is it worth the cost of having unpackaged PHP classes around?
2 Responses to PHP mime_content_type Alternatives In Debian 5.0