0
WordPress에서 실행되는 웹 사이트가 있습니다. 이 사이트의 문서 루트에는 필자의 WordPress 설치와 무관 한 PHP 스크립트를 테스트하는 디렉토리가 있습니다. 필자는 실제로 존재하는 파일을 필요로하거나 포함 할 때마다 404를 얻습니다. 필자가 require 문을 주석 처리하면 모두 잘됩니다. 처음에는 구문 오류로 인해 발생했습니다. 하지만 난 그것을 청소하고 더 이상 error_log 파일에 아무것도 얻지 않습니다. 뭐라 구요?기존 파일을 포함하면 WordPress 404 페이지가 생성됩니다.
편집 : 내 주 error_log에서 이것을 발견했습니다 : malformed header from script. Bad header=X-UA-Compatible: ide.php
. 나는 다른 아파치 서버에서이 문제를 결코 경험하지 못했다.
ide.php
<?php
require_once 'config.php';
if (isset($_SESSION['username'])) {
if (isset($_POST['command'])) {
if ($_POST['session'] == '@') {
session_destroy();
header('Location: /area51/ide.php');
} else {
echo 'None';
}
} else {
$smarty->assign('version', shell_exec("/home1/tylercro/local/python3/bin/python3 -c \"import sys;print('Python', sys.version)\""));
$smarty->display('ide.tpl');
}
} else {
if (isset($_POST['username']) && isset($_POST['password'])) {
if ($_POST['username'] == 'user' && $_POST['password'] == 'password') {
$_SESSION['username'] = $_POST['username'];
}
header('Location: /area51/ide.php');
} else {
$smarty->display('ide-login.tpl');
}
}
?>
config.php를
<?php
error_reporting(E_ALL);
session_start();
if (!headers_sent()) {
header('X-UA-Compatible: chrome=1');
header('Content-Type: text/html; charset=UTF-8');
}
require_once 'Smarty-3.1.8/Smarty.class.php';
$smarty = new Smarty();
$smarty->setTemplateDir('Smarty-3.1.8/templates/');
$smarty->setCompileDir('Smarty-3.1.8/templates_c/');
$smarty->setCacheDir('Smarty-3.1.8/cache/');
$smarty->setConfigDir('Smarty-3.1.8/configs/');
?>