On Apr 15, 10:24 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
tinman77 wrote:
Quote:
On Apr 15, 8:27 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
tinman77 wrote:
>On Apr 15, 7:56 am, Jerry Stuckle <jstuck...@attglobal.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.dll and also added the lines
>>>mime_magic.debug = Off and
>>>mime_magic.magicfile = "C:\Program Files\PHP\extras\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\wwwroot\visl\contribute.php on
>>>line 43
>>>Warning: finfo::buffer() [function.finfo-buffer]: The invalid fileinfo
>>>object. in C:\Inetpub\wwwroot\visl\contribute.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.magicfile in your php.ini file?
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>jstuck...@attglobal.net
>>==================
> mime_magic.magicfile = "C:\Program Files\PHP\extras\magic.mime"
Don't give it the extension just "...\magic". The extension is added
automatically.
>
Quote:
Quote:
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.
>
Quote:
Quote:
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
>
>
Quote:
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,
>
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...@attglobal.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=18878) 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(FILEINFO_MIME,'C:\PHP\extras\magic');
$mimetype = finfo_file($handle,$_FILES['media']['tmp_name']);
I found my solution at
http://pecl.php.net/bugs/bug.php?id=7555.