【发布时间】:2019-04-24 03:50:41
【问题描述】:
首先,除了这个文件之外,所有代码确实解析并按预期工作。
该文件是来自 CKFinder V3 的 connector.php,旨在使用 JSON 进行响应,但返回的是 PHP 代码。回应:
<?php
/*
* CKFinder
* ========
* http://cksource.com/ckfinder
* Copyright (c) 2007-2016, CKSource - Frederico Knabben. All rights reserved.
*
* The software, this file and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying or distribute this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*/
require_once __DIR__ . '/vendor/autoload.php';
use CKSource\CKFinder\CKFinder;
$ckfinder = new CKFinder(__DIR__ . '/../../../config.php');
$ckfinder->run();
它应该回应的一个例子是:
{"enabled":true,"s":"","c":"F799H8BWZTL","thumbs":["150x150","300x300","500x500"],"images":{"max":"2000x2000","sizes":{"small":"480x320","medium":"600x480","large":"800x600"}},"resourceTypes":[{"name":"Files","allowedExtensions":"7z,aiff,asf,avi,bmp,csv,doc,docx,fla,flv,gif,gz,gzip,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pptx,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xlsx,zip","deniedExtensions":"","hash":"31062ffc66943ba7","acl":1023,"maxSize":2097152,"hasChildren":false,"url":"\/uploads\/files\/"},{"name":"Images","allowedExtensions":"bmp,gif,jpeg,jpg,png","deniedExtensions":"","hash":"8bca000aae25ed21","acl":1023,"maxSize":2097152,"hasChildren":true,"url":"\/uploads\/images\/"}],"uploadMaxSize":2097152,"uploadCheckImages":false}
我不知道为什么这个特定的文件不想玩。
Chrome 开发工具的响应标头为 content-type: application/x-httpd-php 我没有看到任何其他具有该内容类型的文件。所有其他可用的页面都有content-type: text/html; charset=UTF-8,但没有一个以.php 结尾,因为它们是用mod_rewrite 重写的,如果重要的话。
connector.php 的权限与正常工作的站点(不同的服务器)相同。 root:root 644
我看过很多关于 AddHandler 和 AddType 的类似问题。
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
和
AddType application/x-httpd-php php
我已经在 .htaccess 和 php.ini 中实现了这些,但没有任何效果。
服务器是一个运行 apache Apache/2.4.10 (Debian) 和 PHP 7.1.27 的 Docker 机器
我很高兴提供 phpinfo() 输出、Dockerfile、.htaccess 任何有帮助的东西。请让我知道相关部分。
【问题讨论】:
-
php apache 模块安装了吗?
-
@NickMaroulis 是的。我提到了其他所有东西都会解析。我刚刚发现了问题。感谢您的关注。