Opened 5 years ago

Closed 5 years ago

#1485154 closed Bugs (fixed)

rcube_shared.inc - function rc_mime_content_type (on windows wamp/xampp

Reported by: rosali Owned by:
Priority: 5 Milestone: 0.2-beta
Component: PHP backend Version: 0.2-alpha
Severity: normal Keywords:
Cc:

Description

This is partially a following up of ticket #1485141.

On windows xampp/wamp mime detecting does not work by default. It is really hard to set it up. So, maybe you want to consider the following.

Please change the function to:

_

function rc_mime_content_type($path, $failover = 'unknown/unknown')
{

global $CONFIG;

$mime_magic = $CONFIGmime_magic?;


Find me: bug: do not trust mime_content_type result !!

if (function_exists('mime_content_type')) {

$ret = @mime_content_type($path);
if(!$ret){

$mime_type = $failover;

}

}


if (!extension_loaded('fileinfo')) {

if (!dl('fileinfo.' . PHP_SHLIB_SUFFIX)) {

$mime_type = $failover;

}

}

$finfo = @finfo_open(FILEINFO_MIME, $mime_magic);
if (!$finfo) {

$mime_type = $failover;

}
$mime_type = @finfo_file($finfo,$path);
if (!$mime_type) {

$mime_type = $failover;

}
@finfo_close($finfo);


split off charset
$temparr = array();
$temparr = explode(";",$mime_type);
$mime_type = $temparr[0];


$temparr = array();
$temparr = explode("\t",$mime_type);
$mime_type = $temparr[0];


return $mime_type;

}

_

Reason: mime_content_type exists but returns null or false on mis-configured setup.

For all XAMPP/WAMP users:

  • copy all files beginning with "mime" into /apache/conf (I'm not sure if you need really all)
  • open /apache/bin/php.ini an define there:

[mime_magic]

mime_magic.magicfile = "D:\xampp\apache\conf\magic" (adjust !!!! not magic.mime !!!!)

mime_magic.debug = "0"

  • open roundcube config main.inc.php and set

$rcmail_configmime_magic? = 'D:/xampp/apache/conf/magic';
(adjust !!!!)

  • restart apache and you should be done!

-Roland

Change History (2)

comment:1 Changed 5 years ago by alec

  • Component changed from Client Scripts to PHP backend
  • Milestone changed from later to 0.2-beta

comment:2 Changed 5 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [403e3f4b].

Note: See TracTickets for help on using tickets.