RHEL5/PHP 5.1.6

I'm having some trouble getting the Fileinfo package working. It installed fine, and phpinfo() says it's enabled. But it consistently returns an empty string when getting the MIME of a file.

/usr/share/pear/bin/pecl install fileinfo
vi /etc/php.d/fileinfo.ini

ln -s /usr/share/file/magic /etc/magic.mime

The code:

define('FINFO_PATH', '/usr/share/file/magic');
$fi = new finfo(FILEINFO_MIME, FINFO_PATH);
$type = $fi->file($file_path);

$type is always empty. And, yes, the path to the file is good.

This works fine on the dev box (PHP 5.2.6). Unfortunately, the decision to use RHEL5 for production was out of my hands and I'm stuck with this older version. At least, I'm thinking it might be due to that. I didn't see anything in the manual about it, though.

I did come across a post[1] online about doing file conversions where the guy mentions rolling an upgrade to 5.2.4 for RHEL5 but wasn't specific as to whether it was necessary to get Fileinfo to work at all. I might try using that upgrade but thought I'd do a sanity check here first. Any other reason it'd be returning nothing?

[1] http://bhuga.net/2008/07/setting-your-system-file-conversions-with-file-framework

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to