wiki:FileinfoInstallation

Version 1 (modified by sander, 9 years ago) (diff)

--

Officeshots needs the Fileinfo extension for PHP in order to scan uploaded documents for the correct mimetype. Debian Lenny does not currently ship with this extension, nor is it available from backports.org. You need to build it yourself. Luckily, this is very easy on Debian Lenny.

Requirements

  • Build environment (build-essential)
  • Development headers (php5-dev, libmagic-dev)
  • PHP build and package scripts (dh-make-php)
  • Fakeroot, to build packages as non-root (fakeroot)

Patch the build script

Debian can automatically download, configure and build any PECL extension. However, there is a bug in the dh-make-pecl script that needs to be fixed first. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512741

The bug is very easy to fix. Open /usr/bin/dh-make-pecl. Line 126 reads:

PECLPACKAGENAME=$(echo ${TEMPMSG} | awk -F ' ' '{print $2'})

Change this to:

PECLPACKAGENAME=$(echo ${TEMPMSG} | sed 's/.*downloading \([^ ]*\).*/\1/g' )

Download the package

Create a new directory somewhere and move into it. Now execute:

dh-make-pecl --depends libmagic1 --build-depends libmagic-dev --only 5 fileinfo

The package is now downloaded and configured.

Build the package

cd php-fileinfo-1.0.4
dpkg-buildpackage -rfakeroot

The package is now built.

Install the package

cd ..
dpkg -i php5-fileinfo_1.0.4-1_i386.deb