Page 1 of 1

FileInfo Is Driving Me Insane

Posted: Sun Jun 07, 2009 3:39 pm
by Comrade Jack
OK, I am trying to setup a secure web form, so I want to have something that will allow me to accurately check the MIME type of the files being uploaded. My research has revealed that the best bet to do that is the fileinfo php extension. I have compiled the extension with the following:

Code: Select all

pecl install fileinfo
After installing some dependencies I was able to get it to be compiled and recognized by pear and shows up when I list pear's installed packages. I have also added the following line to my php.ini file:

Code: Select all

extension=fileinfo.so
After some problems with getting the browser to figure out where the fileinfo.php file was, I copied it to the php root directory. I also enabled the dl() function. I get this error:

Code: Select all

 
Warning: dl() [function.dl]: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/fileinfo.so' - /usr/lib/php5/20060613+lfs/fileinfo.so: cannot open shared object file: No such file or directory in /usr/share/php/fileinfo.php on line 3
fileinfo extension is not avaliable, please compile it.
What I'm particularly concerned with is the "fileinfo extension is not avaliable, please compile it." line. This has been showing up in the last few error messages, and I don't know what to do. I tried installing fileinfo from source, but I get this error:

Code: Select all

/usr/local/src/Fileinfo-1.0.3/fileinfo.c:127:45: error: macro "ZEND_ME_MAPPING" requires 4 arguments, but only 3 given
 
I am at a loss as to what to do. Can anyone help me with this problem, or suggest some other means of checking the MIME type. I am about to blow a gasket over this!

Re: FileInfo Is Driving Me Insane

Posted: Sun Jun 07, 2009 5:21 pm
by Weirdan
If you enabled an extension via php.ini you don't need to dl() it. So you can safely disable dl and rule one possible reason out.

Re: FileInfo Is Driving Me Insane

Posted: Sun Jun 07, 2009 5:25 pm
by Weirdan
This is where php expects to find that extension (.so file):
/usr/lib/php5/20060613+lfs/fileinfo.so
And this:
cannot open shared object file: No such file or directory
tells it's not there.