SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    finfo_open on PHP 5.3.3

    Hi,

    I have the following code to get a MIME type:
    PHP Code:
    $file OFF_URL "file/".$filename;
      
      
    $finfo finfo_open(FILEINFO_MIME_TYPE);
      if (!
    $finfo) {
        echo 
    "Opening fileinfo database failed";
        exit();
    }
      
    $fmime finfo_file($finfo$file);
      
    finfo_close($finfo); 
    But I get the following error:
    PHP Fatal error: Call to undefined function finfo_open() in ...

    It's the first time I've used finfo, but I thought it was included with PHP 5.3.0+?

    Cheers,
    Rhys

    EDIT: Figured it out. The extension needed activating.

    Cheers
    Last edited by TacMaf; Nov 1, 2011 at 08:52. Reason: Solution found

  2. #2
    SitePoint Member
    Join Date
    Dec 2004
    Location
    laval
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    finfo is not a PHP extension. It is a PEAR Module you will need to install PEAR first and then install the finfo PEAR module by running this command
    pear install fileinfo
    you also might have to go edit php.ini to include the extension

  3. #3
    SitePoint Guru TacMaf's Avatar
    Join Date
    Dec 2005
    Location
    Manchester, United Kingdom
    Posts
    663
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. I was having some trouble. It's a windows server and PEAR is installed. editting php.ini seems to have worked so it must have been installed. Cheers.


Bookmarks

Posting Permissions

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