Howto install a PHP FileInfo module in Linux?

The steps to install the PHP ‘Fileinfo’ module on a Linux server is as below:

1) Download and untar the package

# wget http://pecl.php.net/get/Fileinfo-1.0.4.tgz
# tar -zxf Fileinfo-1.0.4.tgz
# cd Fileinfo-1.0.4

2) Generate the extension for compiling

# phpize

3) Configure the module

# ./configure

4) generate the install files and install it

# make 
# make install

5) Now the extension will be available under the /usr/lib64/php/modules directory. You now need to add the extension somewhere in the php configuration file.

Edit /etc/php.ini and add the following:

extension=fileinfo.so

6) Save the file and restart the webserver

# service httpd restart

To verify fileinfo module is enabled properly, execute:

# php -i | grep fileinfo
fileinfo support => enabled

Alternate method

Just an FYI, the module can also be installed using the PECL command i.e.

# pecl install fileinfo

Once done, just follow steps 5 and 6 mentioned above to enable it. That’s it.

This entry was posted on Saturday, July 9th, 2011 and is filed under Installations. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.