【问题标题】:Apache conflicts with MIME types after upgrading from PHP 5.5 -> 5.6从 PHP 5.5 -> 5.6 升级后 Apache 与 MIME 类型冲突
【发布时间】:2018-04-06 18:51:30
【问题描述】:

在 PHP5.5 -> 5.6 迁移后不久,我在 Chrome 控制台中注意到了这些警告:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://www.example.com/wp-content/themes/rowling/style.css?ver=4.7.3".

这些警告会阻止 css 的加载,并且页面会被破坏。

我还注意到,从页面中删除 <!DOCTYPE html> 声明可以解决问题。但这到底是怎么回事?为什么会这样?


问题存在于所有文件(不仅是 css)、所有 .jpg、.mp4 中,所有文件都带有 Content-Type: text/html 的响应

robot@iMac:~$ curl -I https://www.example.com/image.jpg HTTP/1.1 200 OK Date: Thu, 26 Oct 2017 09:17:12 GMT Server: Apache/2.4.29 (Ubuntu) Content-Type: text/html; charset=UTF-8

附言

Apache 模块:mod_mimemod_mime_magic 处于活动状态。

【问题讨论】:

标签: apache warnings mime-types php-5.6 php-5.5


【解决方案1】:

好的,找到并解决了问题!

/etc/apache2/apache2.conf 我找到了这条线 SetHandler application/x-httpd-php

删除后问题就消失了。

所有响应现在都可以正常工作了!哑剧类型没问题。

【讨论】:

    猜你喜欢
    • 2018-01-11
    • 2013-07-29
    • 2013-12-08
    • 1970-01-01
    • 2016-05-07
    • 1970-01-01
    • 2016-08-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多