finfo yolu bulunamadı

2 Cevap

Ben 5.3.1 kulüpler ve dokümanlar okuduktan sonra, ben fileinfo dahil olduğunu ve pecl artık gerekli olduğunu görüyoruz. Ben ancak alıyorum:

finfo_file (): Dosya veya yol bulunamadı

Ben o arıyor ne emin değilim. Ben ini dosyasında uzantısı etkin ve PHP sitesinden örnek çalıştırmak için çalıştık:

$finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension
foreach (glob("*") as $filename) {
    echo finfo_file($finfo, $filename) . "\n";
}
finfo_close($finfo);

Birisi ne gerek dosya bana söyleyebilir?

2 Cevap

Sen "sihirli veritabanı dosyası", ya da, başka bir olasılık olarak nerede PHP bilir böylece ortamını yapılandırmak için ya da gerek, çağrılırken fileinfo_open , you need to specify the path to the magic database file (quoting):

Name of a magic database file, usually something like /path/to/magic.mime.
If not specified, the MAGIC environment variable is used.
If this variable is not set either, /usr/share/misc/magic is used by default. A .mime and/or .mgc suffix is added if needed.


See the example given on the manual page of fileinfo_open, for instance (quoting) :

$finfo = finfo_open(FILEINFO_MIME, "/usr/share/misc/magic"); // return mime type ala mimetype extension

if (!$finfo) {
    echo "Opening fileinfo database failed";
    exit();
}

/* get mime-type for a specific file */
$filename = "/usr/local/something.txt";
echo finfo_file($finfo, $filename);

/* close connection */
finfo_close($finfo);

Of course, up to you to find where that file is on your system...

Ben sadece zor magic.mime dosyasının yolunu phpinfo(): girdi "mime_magic.magicfile" aramaya çalışırken bulundu olmaktır benim hosting şirketi keşfetti ettik. Listede yok ise hosting şirketinize başvurun ve açıklamak PHP için bu dosyayı ve yolunu ihtiyaç finfo(). Benim için çalıştı.