Linux – PHP Fileinfo in custom PHP build – Linux

debianlinuxPHPphp5

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.

Best Answer

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.