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
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