Use other file MIME detection instead of the mime.types file

Stephan Vanhaverbeke - July 15, 2008 - 16:04
Project:File Framework
Version:6.x-1.0-alpha2
Component:Code
Category:bug report
Priority:normal
Assigned:miglius
Status:closed
Issue tags:MIME
Description

Did a clean install, together with following modules:
- RDF
- DAV
- BitStream

When I go to the 'Mime' tab in the Files Administration section, I get this error:
warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/opt/local/apache2/conf/mime.types) is not within the allowed path(s): (/var/www/vhosts/ubeon.biz/subdomains/office/httpdocs:/tmp) in /var/www/vhosts/ubeon.biz/subdomains/office/httpdocs/modules/fileframework/file.inc on line 227.

Note the colon after 'httpdocs', which is the root for this site.

The same error repeats itself multiple times.

The same error occurs when I return from 'viewing' an uploaded file.
Please advize.

#1

miglius - July 16, 2008 - 08:32

I think you're getting this error because your php is run in a safe mode http://lt.php.net/manual/en/features.safe-mode.php

Try entering the location of the MIME file in the file settings page.

#2

osman - March 16, 2009 - 00:56

I am having the same error and am pretty sure safe_mode is set to OFF.

I began to get this error after I moved the site from one server to another. Mirrored every single settings (I think). But something is missing obviously.

Any updates on this issue? Thanks,

Drupal 6.10
File Framework 6.x-1.0-alpha3
Bitcache 6.x-1.0-beta1
Resource Description Framework (RDF) 6.x-1.0-alpha6

#3

miglius - March 16, 2009 - 09:28

Does mime.types file have a read permissions for the user running the web server?

#4

osman - March 17, 2009 - 19:05

That's what I am told. It's a dedicated-virtual box. Currently root access is not enabled (it is optional). But I was told I have read access to that file.

I entered the path "/etc" to Path to the server's MIME type definitions 'mime.types' file field at http://domain.com/admin/settings/file

Even the Server-side MIME type autodetection after upload option is set to Disabled I get this error message:

warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/etc/mime.types) is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs:/tmp) in /var/www/vhosts/domain.com/httpdocs/sites/all/modules/fileframework/file.admin.inc on line 188.
A file /etc/mime.types does not exists or is not readable by the web server.

So, does it mean I do not really have read access to mime.types or there's another issue?

Thanks,

#5

Arto - March 17, 2009 - 19:31
Title:Warning: file_exists() error» MIME types not accessible due to open_basedir restriction

This should be simple to fix. As the error says, there is an open_basedir restriction in effect which prevents Drupal from opening the mime.types file. All you need to do is get a copy of an Apache mime.types file (it's included in most Unix operating systems, including Mac OS X; you could also Google for it), and put it somewhere under your Drupal directory where File Framework can access it.

@Miglius, I suggest we ship a decent mime.types file with File Framework. The ones included with operating system distros tend to be out of date, anyway. Take a look at file_get_mimetype() in core's includes/file.inc; if nothing else, that would be easy to turn into mime.types format and ship as default.

#6

osman - March 17, 2009 - 19:57

Hi Arto,

Thanks for the quick reply. It works without error now.

Cheers,

#7

miglius - March 24, 2009 - 18:15
Assigned to:Anonymous» miglius

#8

miglius - March 24, 2009 - 18:15
Issue tags:-open_basedir+MIME

#9

miglius - March 24, 2009 - 19:11

Agree that we cannot assume that mime.types file is recent. I'm leaning of using file_get_mimetype() as the base for the mime types, giving the possibility for the format* modules to add mime types programaticaly and also adding configuration option for adding new or overwriting existing mime types at the settings pages.

#10

miglius - March 24, 2009 - 19:26
Title:MIME types not accessible due to open_basedir restriction» Use other file MIME detection instead of the mime.types file

#11

Justin Hopkins - March 25, 2009 - 16:42

Thanks Miglius. Thanks Arto.

#12

visualnotion - March 25, 2009 - 16:47

Miglius, do you foresee this coming out in a release soon or do you have an idea of when it would take place?

(I admit I don't know the code or possible rework involved to handle it... I'm just curious as to if you have it mapped out or planned for an upcoming release)

#13

miglius - March 26, 2009 - 10:19

I plan to implement it and commit to cvs by the end of this week so it will be available in the development release. Not sure when a new alpha will be cut though.

#14

visualnotion - March 26, 2009 - 18:54

Thanks for the update, Miglius. I'll have to check it out once things slow down, work-wise.

#15

miglius - March 26, 2009 - 23:30
Status:active» fixed

I have committed the changes. The new code gives more documentation how the MIME detections is performed. Also it abandons dependence on the mime.types file. The system uses the MIME definitions given by the core drupal file.inc file. It's a pity I can not reuse the same file but have to replicate it though...

Also now a new MIME types can be added or existing types overwritten in the configuration area.

Please, test it.

#16

System Message - April 9, 2009 - 23:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.