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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘