Mime Magic and FileInfo Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tinman77

    Mime Magic and FileInfo Help

    Hello,

    I'm having a terrible time using the functions finfo_open and
    finfo_file. I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled
    php_mime_magic. dll and php_fileinfo.dl l and also added the lines
    mime_magic.debu g = Off and
    mime_magic.magi cfile = "C:\Program Files\PHP\extra s\magic.mime".

    Now my phpinfo() says fileinfo support is enabled and mime_magic
    support is enabled. However, I keep getting this error:
    Warning: finfo::finfo() [function.finfo-finfo]: Failed to load magic
    database at '(null)'. in C:\Inetpub\wwwr oot\visl\contri bute.php on
    line 43

    Warning: finfo::buffer() [function.finfo-buffer]: The invalid fileinfo
    object. in C:\Inetpub\wwwr oot\visl\contri bute.php on line 44

    I have tried everything I can think of and I have Googled everything
    under the sun I can think of. Can anyone help?

    Thanks!

    Ryan
  • Jerry Stuckle

    #2
    Re: Mime Magic and FileInfo Help

    tinman77 wrote:
    Hello,
    >
    I'm having a terrible time using the functions finfo_open and
    finfo_file. I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled
    php_mime_magic. dll and php_fileinfo.dl l and also added the lines
    mime_magic.debu g = Off and
    mime_magic.magi cfile = "C:\Program Files\PHP\extra s\magic.mime".
    >
    Now my phpinfo() says fileinfo support is enabled and mime_magic
    support is enabled. However, I keep getting this error:
    Warning: finfo::finfo() [function.finfo-finfo]: Failed to load magic
    database at '(null)'. in C:\Inetpub\wwwr oot\visl\contri bute.php on
    line 43
    >
    Warning: finfo::buffer() [function.finfo-buffer]: The invalid fileinfo
    object. in C:\Inetpub\wwwr oot\visl\contri bute.php on line 44
    >
    I have tried everything I can think of and I have Googled everything
    under the sun I can think of. Can anyone help?
    >
    Thanks!
    >
    Ryan
    >
    What do you have for mime_magic.magi cfile in your php.ini file?

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • tinman77

      #3
      Re: Mime Magic and FileInfo Help

      On Apr 15, 7:56 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      tinman77 wrote:
      Hello,
      >
      I'm having a terrible time using the functions finfo_open and
      finfo_file. I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled
      php_mime_magic. dll and php_fileinfo.dl l and also added the lines
      mime_magic.debu g = Off and
      mime_magic.magi cfile = "C:\Program Files\PHP\extra s\magic.mime".
      >
      Now my phpinfo() says fileinfo support is enabled and mime_magic
      support is enabled. However, I keep getting this error:
      Warning: finfo::finfo() [function.finfo-finfo]: Failed to load magic
      database at '(null)'. in C:\Inetpub\wwwr oot\visl\contri bute.php on
      line 43
      >
      Warning: finfo::buffer() [function.finfo-buffer]: The invalid fileinfo
      object. in C:\Inetpub\wwwr oot\visl\contri bute.php on line 44
      >
      I have tried everything I can think of and I have Googled everything
      under the sun I can think of. Can anyone help?
      >
      Thanks!
      >
      Ryan
      >
      What do you have for mime_magic.magi cfile in your php.ini file?
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===
      mime_magic.magi cfile = "C:\Program Files\PHP\extra s\magic.mime"

      Comment

      • Jerry Stuckle

        #4
        Re: Mime Magic and FileInfo Help

        tinman77 wrote:
        On Apr 15, 7:56 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >tinman77 wrote:
        >>Hello,
        >>I'm having a terrible time using the functions finfo_open and
        >>finfo_file. I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled
        >>php_mime_magi c.dll and php_fileinfo.dl l and also added the lines
        >>mime_magic.de bug = Off and
        >>mime_magic.ma gicfile = "C:\Program Files\PHP\extra s\magic.mime".
        >>Now my phpinfo() says fileinfo support is enabled and mime_magic
        >>support is enabled. However, I keep getting this error:
        >>Warning: finfo::finfo() [function.finfo-finfo]: Failed to load magic
        >>database at '(null)'. in C:\Inetpub\wwwr oot\visl\contri bute.php on
        >>line 43
        >>Warning: finfo::buffer() [function.finfo-buffer]: The invalid fileinfo
        >>object. in C:\Inetpub\wwwr oot\visl\contri bute.php on line 44
        >>I have tried everything I can think of and I have Googled everything
        >>under the sun I can think of. Can anyone help?
        >>Thanks!
        >>Ryan
        >What do you have for mime_magic.magi cfile in your php.ini file?
        >>
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====
        >
        mime_magic.magi cfile = "C:\Program Files\PHP\extra s\magic.mime"
        >
        Don't give it the extension just "...\magic" . The extension is added
        automatically.

        BTW - did you try googling for this? A search on just "mime.magic "
        turned up a bogus bug report containing this information as the fifth hit.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • tinman77

          #5
          Re: Mime Magic and FileInfo Help

          On Apr 15, 8:27 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          tinman77 wrote:
          On Apr 15, 7:56 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          tinman77 wrote:
          >Hello,
          >I'm having a terrible time using the functions finfo_open and
          >finfo_file. I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled
          >php_mime_magic .dll and php_fileinfo.dl l and also added the lines
          >mime_magic.deb ug = Off and
          >mime_magic.mag icfile = "C:\Program Files\PHP\extra s\magic.mime".
          >Now my phpinfo() says fileinfo support is enabled and mime_magic
          >support is enabled. However, I keep getting this error:
          >Warning: finfo::finfo() [function.finfo-finfo]: Failed to load magic
          >database at '(null)'. in C:\Inetpub\wwwr oot\visl\contri bute.php on
          >line 43
          >Warning: finfo::buffer() [function.finfo-buffer]: The invalid fileinfo
          >object. in C:\Inetpub\wwwr oot\visl\contri bute.php on line 44
          >I have tried everything I can think of and I have Googled everything
          >under the sun I can think of. Can anyone help?
          >Thanks!
          >Ryan
          What do you have for mime_magic.magi cfile in your php.ini file?
          >
          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstuck...@attgl obal.net
          =============== ===
          >
          mime_magic.magi cfile = "C:\Program Files\PHP\extra s\magic.mime"
          >
          Don't give it the extension just "...\magic" . The extension is added
          automatically.
          >
          BTW - did you try googling for this? A search on just "mime.magic "
          turned up a bogus bug report containing this information as the fifth hit.
          >
          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstuck...@attgl obal.net
          =============== ===
          Jerry,

          I took your advice and removed the ".mime" and now I get "mime_magic
          support invalid magic file, disabled" in phpinfo(). I Googled
          everything I could think of yesterday and that's why I posted here.
          And I'm still getting the same errors about failing to load the magic
          database at '(null)'.

          Ryan

          Comment

          • Jerry Stuckle

            #6
            Re: Mime Magic and FileInfo Help

            tinman77 wrote:
            On Apr 15, 8:27 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            >tinman77 wrote:
            >>On Apr 15, 7:56 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            >>>tinman77 wrote:
            >>>>Hello,
            >>>>I'm having a terrible time using the functions finfo_open and
            >>>>finfo_fil e. I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled
            >>>>php_mime_ma gic.dll and php_fileinfo.dl l and also added the lines
            >>>>mime_magic. debug = Off and
            >>>>mime_magic. magicfile = "C:\Program Files\PHP\extra s\magic.mime".
            >>>>Now my phpinfo() says fileinfo support is enabled and mime_magic
            >>>>support is enabled. However, I keep getting this error:
            >>>>Warning: finfo::finfo() [function.finfo-finfo]: Failed to load magic
            >>>>database at '(null)'. in C:\Inetpub\wwwr oot\visl\contri bute.php on
            >>>>line 43
            >>>>Warning: finfo::buffer() [function.finfo-buffer]: The invalid fileinfo
            >>>>object. in C:\Inetpub\wwwr oot\visl\contri bute.php on line 44
            >>>>I have tried everything I can think of and I have Googled everything
            >>>>under the sun I can think of. Can anyone help?
            >>>>Thanks!
            >>>>Ryan
            >>>What do you have for mime_magic.magi cfile in your php.ini file?
            >>>--
            >>>============ ======
            >>>Remove the "x" from my email address
            >>>Jerry Stuckle
            >>>JDS Computer Training Corp.
            >>>jstuck...@at tglobal.net
            >>>============ ======
            >> mime_magic.magi cfile = "C:\Program Files\PHP\extra s\magic.mime"
            >Don't give it the extension just "...\magic" . The extension is added
            >automaticall y.
            >>
            >BTW - did you try googling for this? A search on just "mime.magic "
            >turned up a bogus bug report containing this information as the fifth hit.
            >>
            >--
            >============== ====
            >Remove the "x" from my email address
            >Jerry Stuckle
            >JDS Computer Training Corp.
            >jstuck...@attg lobal.net
            >============== ====
            >
            Jerry,
            >
            I took your advice and removed the ".mime" and now I get "mime_magic
            support invalid magic file, disabled" in phpinfo(). I Googled
            everything I could think of yesterday and that's why I posted here.
            And I'm still getting the same errors about failing to load the magic
            database at '(null)'.
            >
            Ryan
            >
            Ryan,

            It sounds like it's now finding the file, but the file is in the
            incorrect format.

            Not sure if it makes a difference, but the default file has UNIX line
            endings; you didn't possibly try to edit and save it with a Windows
            editor, did you?

            How does the file look?

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • tinman77

              #7
              Re: Mime Magic and FileInfo Help

              On Apr 15, 10:24 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              tinman77 wrote:
              On Apr 15, 8:27 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              tinman77 wrote:
              >On Apr 15, 7:56 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              >>tinman77 wrote:
              >>>Hello,
              >>>I'm having a terrible time using the functions finfo_open and
              >>>finfo_file . I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled
              >>>php_mime_mag ic.dll and php_fileinfo.dl l and also added the lines
              >>>mime_magic.d ebug = Off and
              >>>mime_magic.m agicfile = "C:\Program Files\PHP\extra s\magic.mime".
              >>>Now my phpinfo() says fileinfo support is enabled and mime_magic
              >>>support is enabled. However, I keep getting this error:
              >>>Warning: finfo::finfo() [function.finfo-finfo]: Failed to load magic
              >>>database at '(null)'. in C:\Inetpub\wwwr oot\visl\contri bute.php on
              >>>line 43
              >>>Warning: finfo::buffer() [function.finfo-buffer]: The invalid fileinfo
              >>>object. in C:\Inetpub\wwwr oot\visl\contri bute.php on line 44
              >>>I have tried everything I can think of and I have Googled everything
              >>>under the sun I can think of. Can anyone help?
              >>>Thanks!
              >>>Ryan
              >>What do you have for mime_magic.magi cfile in your php.ini file?
              >>--
              >>============= =====
              >>Remove the "x" from my email address
              >>Jerry Stuckle
              >>JDS Computer Training Corp.
              >>jstuck...@att global.net
              >>============= =====
              > mime_magic.magi cfile = "C:\Program Files\PHP\extra s\magic.mime"
              Don't give it the extension just "...\magic" . The extension is added
              automatically.
              >
              BTW - did you try googling for this? A search on just "mime.magic "
              turned up a bogus bug report containing this information as the fifth hit.
              >
              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstuck...@attgl obal.net
              =============== ===
              >
              Jerry,
              >
              I took your advice and removed the ".mime" and now I get "mime_magic
              support invalid magic file, disabled" in phpinfo(). I Googled
              everything I could think of yesterday and that's why I posted here.
              And I'm still getting the same errors about failing to load the magic
              database at '(null)'.
              >
              Ryan
              >
              Ryan,
              >
              It sounds like it's now finding the file, but the file is in the
              incorrect format.
              >
              Not sure if it makes a difference, but the default file has UNIX line
              endings; you didn't possibly try to edit and save it with a Windows
              editor, did you?
              >
              How does the file look?
              >
              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstuck...@attgl obal.net
              =============== ===
              RESOLVED:
              I have spent countless hours trying to figure this one out and I have
              but I've done it a bit different than how I was trying. I downloaded
              GnuWin32 (http://sourceforge.net/project/showfiles.php?
              group_id=23617& package_id=1887 8) and installed it. In the directory C:
              \Program Files\GnuWin32\ share\file there are 4 files. Place these
              files in C:\PHP\extras (or whatever your setup is) and then pass the
              directory to finfo_open as the 2nd parameter. Note in my example below
              magic is a file without an extension (ie. not a directory). Hope this
              helps someone.

              Example:
              $handle = finfo_open(FILE INFO_MIME,'C:\P HP\extras\magic ');
              $mimetype = finfo_file($han dle,$_FILES['media']['tmp_name']);

              I found my solution at http://pecl.php.net/bugs/bug.php?id=7555.

              Comment

              Working...