Take the 2-minute tour ×

We custom build up our PHP installs due to some historic reasons and it gets installed into our custom compile of Apache.

We are now trying to get Fileinfo to load into the PHP build and have tried the usual Pecl install fileinfo and enabling it in the php.ini but it hasn't worked.

Even stranger is that fileinfo shows in phpinfo() output just doesn't list any versions. Trying to run the base finfo functions gives the following error

Fatal error: Class 'finfo' not found

System is Debian Linux. PHP is 5.2.10. We are unable to move to 5.3.0 due to Joomla not working with it.

If anyone can direct us to what could be causing this it'd be much appreciated.

share|improve this question

3 Answers 3

What is your php.ini extension_dir set to?

In our case, pecl installs extensions to /usr/local/lib/php/ext/no-debug-non-zts-20060613, but the extension_dir ini setting is either "./" or "/usr/local/lib/php/ext". The output of the pecl install should have told you where it installed the extension, so you'll just need to change your extension_dir to match or move the fileinfo.so file to the directory specified in php.ini.

share|improve this answer
Changing the ext dir is how we managed to get the module to load. It just wasn't actually function afterwards even though it displayed in phpinfo(); –  Ryaner Aug 7 '09 at 21:40

I had the same problem before. First got fileinfo extension loaded (should display in phpinfo() ). Then check whether there is a symbol link called 'magic' in /usr/share. If not just create one link to file/magic.

share|improve this answer
up vote 0 down vote accepted

We managed to sort this by removing magic_mime and then compiling fileinfo directly into the php install.

remove magic_mime from the ext directory inside of the php source
grab Fileinfo source and put inside of the ext directory
run autoconf in the root php source directory
configure and compile normally
share|improve this answer

Your Answer


