hoyomi
hoyomi

Reputation: 287

PHP 5.3.15 finfo_open() Failed to load magic database

I was trying to upload an image, but I got this message:

finfo_open() [function.finfo-open]: Failed to load magic database at ...(a file location in my project)

I do have magic, magic.mgc, magic.mime and magic.mime.mgc in that location.

I just updated to PHP 5.3.15 a few days ago. I saw this note in the PHP manual:

As of PHP >= 5.3.11 and >= 5.4.1 the magic datababase format has changed. Due to this, the internal mime database was upgraded. This affects especially the code where external magic is read in. Reading in magic files of the older formats will not work. Also, some textual representations of the mime types has changed, for instance for PHP would be "PHP script, ASCII text" instead of "PHP script text" returned.

The project was first developed with PHP 5.3.2. Does this mean my magic database file is not in the correct format?

If it is in a wrong format, where can I find a newer version of magic database? Or what are other solutions? I am using Mountain Lion with Macports.

Upvotes: 1

Views: 3028

Answers (1)

hoyomi
hoyomi

Reputation: 287

I found a solution. Just don't use external magic database. finfo_open will use the default one on system.

Upvotes: 1

Related Questions