Page 1 of 1

The finfo method and functions are missing from XAMPP 1.7.2!

PostPosted: 05. December 2009 06:36
by lamando
Hello!

I've been trying to use the finfo method and the finfo_ functions. They are described to be included by default in PHP 5.3.0+ (see http://www.php.net/manual/en/fileinfo.installation.php ):

This extension is enabled by default as of PHP 5.3.0. Before this time, fileinfo was a PECL extension but is no longer maintained there.


But it seems that they are missing from the latest stable XAMPP (1.7.2):

Fatal error: Class 'finfo' not found [...]


It doesn't seem to be a PHP issue since it is not listed in the fixed bugs in PHP 5.3.1

Can someone confirm that it is a XAMPP issue? Do you encounter the same problem? Here's a quick code to test:

Code: Select all

<php
if 
( function_exists( 'finfo_open' ) ) {
    echo "OMG IT WORKS!!";
}
 else {
    echo "Bad news... :(";
}
?>


Thanks a lot everyone for the hard work, XAMPP is great ;)

Re: The finfo method and functions are missing from XAMPP 1.7.2!

PostPosted: 05. December 2009 06:46
by Izzy
Try editing the \xampp\php\php.ini file and uncomment this line, remove the ; from in front of the extension name
Code: Select all
;extension=php_fileinfo.dll
Save the file and restart Apache and test again.

Re: The finfo method and functions are missing from XAMPP 1.7.2!

PostPosted: 05. December 2009 06:47
by lamando
Update: I've tried to uncomment the line
Code: Select all
extension=php_fileinfo.dll

in php.ini

Resulted in many errors at Apache start and a crash of the apache process after few seconds. I had to comment back the line to be able to start Apache...

:?

Re: The finfo method and functions are missing from XAMPP 1.7.2!

PostPosted: 05. December 2009 06:52
by lamando
Izzy wrote:Try editing the \xampp\php\php.ini file and uncomment this line, remove the ; from in front of the extension name
Code: Select all
;extension=php_fileinfo.dll
Save the file and restart Apache and test again.

Lol burned, had the same idea as you :mrgreen:

I think some file are missing, see:

Image

Image

Apache crashes immediately after I click OK...

Re: The finfo method and functions are missing from XAMPP 1.7.2!

PostPosted: 05. December 2009 07:00
by Izzy
Anything in the \xampp\apache\logs\error.log file?

Re: The finfo method and functions are missing from XAMPP 1.7.2!

PostPosted: 05. December 2009 07:10
by lamando
PHP Warning: Function registration failed - duplicate name - mime_content_type in Unknown on line 0
PHP Warning: mime_magic: Unable to register functions, unable to load in Unknown on line 0
[Sat Dec 05 00:48:51 2009] [warn] pid file [...]xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat Dec 05 00:48:51 2009] [notice] Digest: generating secret for digest authentication ...
[Sat Dec 05 00:48:51 2009] [notice] Digest: done
PHP Warning: Function registration failed - duplicate name - mime_content_type in Unknown on line 0
PHP Warning: mime_magic: Unable to register functions, unable to load in Unknown on line 0

Re: The finfo method and functions are missing from XAMPP 1.7.2!

PostPosted: 05. December 2009 12:11
by Wiedmann
lamando wrote:Update: I've tried to uncomment the line
Code: Select all
extension=php_fileinfo.dll

Resulted in many errors at Apache start and a crash of the apache process after few seconds.

Additionally you must disable the "php_mime_magic.dll" extension.

Re: The finfo method and functions are missing from XAMPP 1.7.2!

PostPosted: 05. December 2009 22:15
by lamando
Wiedmann wrote:
lamando wrote:Update: I've tried to uncomment the line
Code: Select all
extension=php_fileinfo.dll

Resulted in many errors at Apache start and a crash of the apache process after few seconds.

Additionally you must disable the "php_mime_magic.dll" extension.


Thanks for your help. I've disabled the mime_magic extension, now Apache is able to start and there's no error.

However, it still doesn't work, there's no error but it looks like the magic database file is empty :?

For example, the code bellow will always output "text/x-c; charset=us-ascii" for any text files

Code: Select all

<?php

$finfo 
= new finfo(FILEINFO_MIME);
echo $finfo->file('test.js');

?>


:(