Ticket #1485154 (closed Bugs: fixed)

Opened 2 months ago

Last modified 5 weeks ago

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:

- download http://sourceforge.net/project/downloading.php?group_id=23617&use_mirror=kent&filename=file-4.23-bin.zip&33764027[[BR]]

- 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

Changed 2 months ago by alec

  • component changed from Client Scripts to PHP backend
  • milestone changed from later to 0.2-beta

Changed 5 weeks ago by alec

  • status changed from new to closed
  • resolution set to fixed

Fixed in r1594.

Note: See TracTickets for help on using tickets.