PHP mime_content_type () not working in windows

I know that mime_content_type () is deprecated, but it seemed to me that the alternative is worse at the moment. FinfoIt seems to require adding files and changing ini-directions in windows; I do not want to require this for the script that I am doing.

I need to find mimetype files, but when called mime_content_type($filename)on windows it fails. mime_magic.magicfile points to the correct file, but when mime_magic.debug is included in the ini file, I get this error message:

Warning: mime_content_type()[http://www.php.net/mime_magic]: mime_magic not initialized in C:\xampp\htdocs\test.php on line 2

I am not sure if this is a problem, or if it is still happening, when I turn off debugging and it just does not tell me.

I checked and is extension=php_mime_magic.dllincluded in the ini file, and httpd.conf indicates

LoadModule mime_module modules/mod_mime.so
#LoadModule mime_magic_module modules/mod_mime_magic.so

I am using XAMPP 1.6.5.

+3
3

. , script 'FOO' is not a valid mimetype, entry skipped?

, Fileinfo..

, - debug, "On" 1? , , , .


, , , , .

, mime_content_type ?

+1

, Finfo ini- ; script, .

finfo_buffer? , :

$finfo = new finfo;
$filename = $_GET['filename'];
var_dump($finfo->buffer(file_get_contents($filename)));

, mime - ?

0

Fileinfo could be a trick for working on Windows. Instructions here: http://forums.zend.com/viewtopic.php?f=8&t=337#p14681

0
source

Source: https://habr.com/ru/post/1698209/


All Articles