From: Thodoris on 13 May 2009 13:05
> fileinfo.so is, indeed, in /usr/lib/php/modules. But I know it's
> enabled, in any case.
> So, anyone know if this extension doesn't work well with 5.1.6?
Well you could enable the error messages to see what is going wrong. The
$type var is probably empty because the instantiation of the $fi object
fails for some reason.
From: brian on 13 May 2009 13:34
>> fileinfo.so is, indeed, in /usr/lib/php/modules. But I know it's
>> enabled, in any case.
>> So, anyone know if this extension doesn't work well with 5.1.6?
> Well you could enable the error messages to see what is going wrong. The
> $type var is probably empty because the instantiation of the $fi object
> fails for some reason.
If the instantiation fails, I should see "Fatal error: Call to a member
function on a non-object" I would think.
As it turns out, this was all due to open_basedir not having the path
/usr/share/file included. All is good. Thanks for your help.
From: "Michael A. Peters" on 14 May 2009 00:06
> 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 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?
I'm running php 5.2.9 on CentOS 5 with FileInfo 1.0.4
I have src.rpm's here:
Works well enough for me.