douqin7086
2012-08-02 08:29
浏览 23
已采纳

PHP pecl和当前finfo版本

i need to determine the filetype of an file with php (5.3.7), no matter what filenameextension is used.

On Linux OS system i would use read the first Bytes from a file to find out the exact file type.

I think this is possible in PHP by using finfo

The Point is: my Server is not connected to the Internet, so I have to download the finfo PECL extension manually.

All that i found was this website: http://pecl.php.net/package/Fileinfo where the current finfo version is from from November 2006.

There is also an hint "his package has been superseded". But superseded by what? If i take a look at this http://www.php.net/manual/en/fileinfo.installation.php there is no information where i found this package.

The only thing i found there is "This extension is enabled by default as of PHP 5.3.0. " Does it mean, that this extension is part of every default >=PHP 5.3.0 installation? But if i try to use finfo commands, i get an Call to undefined function which looks like finfo is not installed, right?!

//Edit: by the way: i'm working on Linux, PHP 5.3.7

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • drq9991 2012-08-02 11:29
    已采纳

    To answer my own question: I was on an wrong way for searching an new pecl file_info version. For Linux Systems there exits an PHP package, which contains that extension, like this: php5-fileinfo-5.3.6-75.1.x86_64.rpm (depending on your Linux Distribution and PH Version) To use fileinfo, you have install this package, like this:

    #rpm -ihv php5-fileinfo-5.3.6-75.1.x86_64.rpm

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题