2012-05-24 25 views
0

我有一個運行WordPress的網站。在這個站點的文檔根目錄中,我有一個目錄,在該目錄中我測試了與我的WordPress安裝無關的PHP腳本。我注意到無論何時我需要或包含一個確實存在的文件,我都會得到一個404。如果我註釋掉require語句,一切都很好。起初,這是因爲語法錯誤。但是我清理了它,並且不再在error_log文件中獲取任何內容。是什麼賦予了?包含現有文件會產生WordPress的404頁面

編輯:發現這在我的主要error_log:malformed header from script. Bad header=X-UA-Compatible: ide.php。我在其他Apache服務器上從來沒有遇到過這個問題。

下面是有問題的腳本:

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/'); 

?> 

回答

0

這是一個頭的問題。我在發送的頭文件中有一些語法錯誤。