Results 1 to 1 of 1
  1. #1

    Default Installing the Fileinfo PHP extension

    The Fileinfo extension is enabled by default with PHP 5.3.0 and later, but in earlier versions of PHP (such as PHP 5.2.9 as available from the WestHost Site Manager), Fileinfo is a PECL extension that must be installed manually.

    You can install the Fileinfo extension and it's dependency (libmagic) by running the following SSH commands:
    Code:
    curl ftp://ftp.astron.com/pub/file/file-5.03.tar.gz | tar -xzv
    cd file-5.03/
    ./configure && make && make install
    pecl install fileinfo
    Next, you'll need to edit your /etc/php.ini file to load the fileinfo extension. Add the following line at the end of the "Dynamic Extensions" section (around line 597):
    Code:
    extension=fileinfo.so
    Finally, restart the Apache web server by clicking on "Restart Your Account" within Site Manager or by running this command via SSH:
    Code:
    apachectl restart

    Note: In your PHP code, it is necessary to use the magic file /usr/local/share/misc/magic.mgc instead of the default magic file. In other words, the second parameter of the finfo_open() function call should be '/usr/local/share/misc/magic.mgc'
    Last edited by nventurella; 11-23-2009 at 01:32 PM.
    Nick Venturella
    WestHost Technical Support
    Contact Support: E-mail | Live Chat

    When you expect more from your Web host
    http://www.westhost.com/

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •