mime_content_type()返回“text / plain”;对于大型Quicktime文件 - 帮助 [英] mime_content_type() returns "text/plain" for large Quicktime files - HELP

查看:85
本文介绍了mime_content_type()返回“text / plain”;对于大型Quicktime文件 - 帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[PHP]

echo mime_content_type(''/ var / www / html / video / small.mov''); //

1.5mb Quicktime视频返回"视频/ quicktime"

10.5mb Quicktime视频返回" text / plain"

[/ PHP]


环境:


PHP 5.0.4 - Windows XP - 启用 - mime-magic

PHP 4.3.11 - Fedora Core 4 - 启用mime-magic


在这两种情况下, - enable-mime_magic允许使用PHP

安装。在这两种情况下,如果Quicktime视频很小,则返回的

MIME类型是正确的;如果Quicktime视频很大,返回的MIME

类型是错误的。


我们设法在/etc/php.ini上更改upload_max_filesize并重新启动 HTTPD,但是,这并没有解决mime_content_type()问题。


我们甚至将mime_magic.path变量更改为指向HTTPD

(阿帕奇)的'魔术'文件而不是PHP'''magic.mime"文件,修复了

早期的PNG图像问题,但没有大MOV文件。


有什么建议吗?


Thanx

Phil

解决方案

大型电影文件可能包含预览信息。尝试添加此行

到magic.mine:


4 string pnot video / quicktime

我们在魔术文件中实现了这一行,然而,问题不仅仅是b $ b持续存在,我们发现几乎任何超过8.3mb的文件都会结束

with atext / plain MIME类型。


我怀疑Apache内部正在重置最大文件大小

(我认为LimitRequestBody),但是,我们正在使用Apache 2.0.53和

Apache 2.0.54并且该变量在任何地方都找不到,此外,

将该行添加到httpd.conf没有任何区别。


Phil


comp.lang.php(ph ************** @ gmail.com)写道:

:我们将这一行实现到魔术文件中,然而,问题不是

:带有text / plain MIME类型。


:我怀疑Apache内部正在重置最大文件大小

:(我认为LimitRequestBody),但是,我们''重新使用Apache 2.0.53和

:Apache 2.0.54并且该变量在任何地方都找不到,此外,

:将该行添加到httpd.conf没有任何区别。


我不明白为什么apache max文件大小应该有所不同。


但是标题中的数据结构快速时间文件可能需要根据文件的大小进行更改(例如,大小字段可能需要更多字节,因此会破坏标头中的正常偏移)所以文件的

标题区域对于大文件看起来可能不同。


我不能提供详细信息,从不必使用它们,但我会

检查一些大型快速时间文件开头的字节数和

将它们与较小的快速时间文件中的字节进行比较,并将所有

与mime magic配置中的数据进行比较。


我怀疑你会发现大文件与mime magic
config。


但是,您可能会发现大文件的共性,例如

签名略有不同地方,然后你可以把

那个放到mime魔法配置文件中,之后会返回正确的mime信息




[PHP]
echo mime_content_type(''/var/www/html/video/small.mov''); //
1.5mb Quicktime video returns "video/quicktime"
echo mime_content_type(''/var/www/html/video/huge.mov''); //
10.5mb Quicktime video returns "text/plain"
[/PHP]

Environment:

PHP 5.0.4 - Windows XP --enable-mime-magic
PHP 4.3.11 - Fedora Core 4 --enable-mime-magic

In both cases, "--enable-mime_magic" was allowed with PHP
installations. In both cases, if the Quicktime video is small, the
MIME type returned is right; if the Quicktime video is large, the MIME
type returned is wrong.

We managed to change upload_max_filesize on /etc/php.ini and restarted
HTTPD, however, this did not fix the mime_content_type() problem.

We even changed the mime_magic.path variable to point to HTTPD
(Apache)''s "magic" file instead of PHP''s "magic.mime" file, which fixed
an earlier problem with PNG images, but not with large MOV files.

Any suggestions?

Thanx
Phil

解决方案

The large movie file might contain preview info. Try adding this line
to magic.mine:

4 string pnot video/quicktime


We implemented that line into the magic file, however, the problem not
only persists, we found out that nearly any file over 8.3mb winds up
with a "text/plain" MIME type.

I''m suspecting something within Apache is resetting the max file size
(I think LimitRequestBody), however, we''re using Apache 2.0.53 and
Apache 2.0.54 and that variable is no found anywhere, furthermore,
adding that line to httpd.conf makes no difference.

Phil


comp.lang.php (ph**************@gmail.com) wrote:
: We implemented that line into the magic file, however, the problem not
: only persists, we found out that nearly any file over 8.3mb winds up
: with a "text/plain" MIME type.

: I''m suspecting something within Apache is resetting the max file size
: (I think LimitRequestBody), however, we''re using Apache 2.0.53 and
: Apache 2.0.54 and that variable is no found anywhere, furthermore,
: adding that line to httpd.conf makes no difference.

I don''t see why the apache max file size should make any difference.

However the data structures in the header of the quick time file may have
to change based on the size of the file, (e.g. perhaps a size field takes
more bytes, thus upsetting the normal offsets in the header) and so the
header area of the file may look different for large files.

I can''t give the details, never having had to use them, but I would
examine the bytes at the start of a number of large quick time files and
compare them to the bytes in smaller quick time files, and compare all
that to the data in the mime magic configuration.

I suspect that you will find the large file does not match the mime magic
config.

However, you will probably find a commonality of the large files, such as
the signature being in a slightly different place, and then you can put
that into the mime magic config file, after which the correct mime info
will be returned.


这篇关于mime_content_type()返回“text / plain”;对于大型Quicktime文件 - 帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆