PHP文件未被解析并使用application / x-httpd-php而不是JSON进行响应

问题描述 投票:0回答:1

首先,除了这个文件之外,所有代码都会按预期进行解析和工作。

该文件是来自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 ckfinder
1个回答
0
投票

Sonofa ...花几个小时头撞墙,发布,2分钟后找到它。

Docker文件有:

echo "  <LocationMatch assets/>"; \
echo "    php_flag engine off"; \
echo "  </LocationMatch>"; \

文件的完整URL:https://dev.site.com/cms/modules/app/assets/js/ckfinder/core/connector/php/connector.php?command=Init&lang=en&id=foo

© www.soinside.com 2019 - 2024. All rights reserved.