JustFoo Posted July 11, 2006 Share Posted July 11, 2006 Hello all,I am attempting to use the mime_content_type('filename') function that comes in the mime_magic dll, I followed all instructions to set it up and edited the php.ini file and restarted the server and this morning it worked 2 times then just stopped working for some reason. The script i had running doesnt show the mimetype of files anymore. Script:$file = "\\pathToFile\\php.gif";echo mime_content_type($file);php.ini:extension=php_mime_magic.dll[mime_magic]mime_magic.debug = onmime_magic.magicfile = "c:\PHP\extras\magic.mime"thanks for any helpJustFoo Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/ Share on other sites More sharing options...
Daniel0 Posted July 11, 2006 Share Posted July 11, 2006 Try putting [code]ini_set('display_errors',true);error_reporting(E_ALL);[/code] in the top of the script and see if any errors are returned. Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56205 Share on other sites More sharing options...
JustFoo Posted July 11, 2006 Author Share Posted July 11, 2006 Warning: mime_content_type() [http://www.php.net/mime_magic]: mime_magic not initialized in C:\path to script\test.php on line 6 line 6 is echo mime_content_type($file);mime_magic shows up if i do like phpinfo(); Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56209 Share on other sites More sharing options...
Daniel0 Posted July 11, 2006 Share Posted July 11, 2006 Did you set the correct path? Try replacing the backslashes with forward slashes and see if it helps. Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56214 Share on other sites More sharing options...
JustFoo Posted July 11, 2006 Author Share Posted July 11, 2006 same exact error idk why but a little while ago it worked fine the way i had the script it returned image/gif and then i tried a different file and it returned that mime type then when i tried a third file it just stopped printing out the type and then i did a is_function(mime_content_type) and it told me that its not a function and now im here... Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56221 Share on other sites More sharing options...
Daniel0 Posted July 11, 2006 Share Posted July 11, 2006 Attach the magic.mime so we can see if it's a correct file (click on 'Additional Options...' when posting). Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56224 Share on other sites More sharing options...
JustFoo Posted July 11, 2006 Author Share Posted July 11, 2006 magic.mime[attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56227 Share on other sites More sharing options...
Daniel0 Posted July 11, 2006 Share Posted July 11, 2006 Should be the correct file. I have no idea why this don't work. Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56245 Share on other sites More sharing options...
JustFoo Posted July 11, 2006 Author Share Posted July 11, 2006 why would it say its not initialized?? Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56251 Share on other sites More sharing options...
JustFoo Posted July 11, 2006 Author Share Posted July 11, 2006 now it says on my phpinfo page mime_magic support invalid magic file, disabled Directive Local Value Master Value mime_magic.debug On On mime_magic.magicfile c:\PHP\extras\magic.mime c:\PHP\extras\magic.mime Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56253 Share on other sites More sharing options...
JustFoo Posted July 11, 2006 Author Share Posted July 11, 2006 anyway i can get a new mime.magic file or something?? Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56257 Share on other sites More sharing options...
Daniel0 Posted July 11, 2006 Share Posted July 11, 2006 Try [url=http://www.google.com/search?q=magic.mime]searching on Google for 'magic.mime'[/url]. Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56273 Share on other sites More sharing options...
JustFoo Posted July 11, 2006 Author Share Posted July 11, 2006 i redownloaded php and took the mime file from that and it still didn't work. Any other ideas????thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56283 Share on other sites More sharing options...
JustFoo Posted July 11, 2006 Author Share Posted July 11, 2006 i restarted the web server and again the function worked fine then all of a sudden just stopped working again...is there any other way to figure out the type of a file not based on the file extension alone??? Quote Link to comment https://forums.phpfreaks.com/topic/14294-mime_magic-file/#findComment-56336 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.