PDA

View Full Version : سوال: ارور در هدر سایت php



mh2002ir
دوشنبه 03 تیر 1392, 14:33 عصر
سلام دوستان و اساتید محترم
من قسمتهایی از فایل رو ویرایش کردم و به این ارور مواجه شدم:

Warning: session_start() [function.session-start (http://www.tehranshahr.org/function.session-start)]: Cannot send session cookie - headers already sent by (output started at /home/admin/domains/tehranshahr.org/public_html/header.php:1) in /home/admin/domains/tehranshahr.org/public_html/header.php on line 3

Warning: session_start() [function.session-start (http://www.tehranshahr.org/function.session-start)]: Cannot send session cache limiter - headers already sent (output started at /home/admin/domains/tehranshahr.org/public_html/header.php:1) in /home/admin/domains/tehranshahr.org/public_html/header.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/tehranshahr.org/public_html/header.php:1) in /home/admin/domains/tehranshahr.org/public_html/header.php on line 7

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/tehranshahr.org/public_html/header.php:1) in /home/admin/domains/tehranshahr.org/public_html/header.php on line 9

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/tehranshahr.org/public_html/header.php:1) in /home/admin/domains/tehranshahr.org/public_html/header.php on line 11

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/tehranshahr.org/public_html/header.php:1) in /home/admin/domains/tehranshahr.org/public_html/header.php on line 13

Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/tehranshahr.org/public_html/header.php:1) in /home/admin/domains/tehranshahr.org/public_html/header.php on line 15

و البته فایل مربوطه این است :

<?php

session_start();

ob_start();

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past

header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified

header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1

header("Cache-Control: post-check=0, pre-check=0", false);

header("Pragma: no-cache"); // HTTP/1.0

include 'date.php';

include 'cnn.php';

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta name="samandehi-secure-footprint" content="samandehi-secure-footprint:4d543930484a524e5a7136647a59496168525a38 6557316a4b5452566344495959737a344950366c6e35553d">

<title> «تهرانشهر » <?php echo $_GET[tt] ?></title>

<link href="css.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" href="scripts/nivo-slider.css" type="text/css" media="screen" />

<link rel="stylesheet" href="style.css" type="text/css" media="screen" />

<link href="image/mojmal.ico" rel="shortcut icon" type="image/x-icon" />

</head>



<body>

<table width="1000px" dir="rtl" align="center" cellpadding="0" cellspacing="0" bgcolor="#ffffff" border="0">

<tr height="131px">

<td colspan="4">

<table width="1000px" height="131px" align="center" cellpadding="0" cellspacing="0" border="0">





<tr height="110px">

<td colspan="3" valign="bottom" align="center" height="110px" width="1000px" bordercolor="#FF0000" >

<img src="image/header.gif" height="110px" border="0" vspace="0" hspace="0" align="middle" usemap="#rss" title="TehranShahr.org" >

<map name="rss" id="rss">

<area href="rss.php" shape="rect" coords="47,46,74,71" title="RSS">

</map>

</td>

</tr>

<tr height="21px" align="right" valign="top">

<td height="21px" width="853px" style="background-image:url(image/ls.jpg); background-repeat:no-repeat" align="right" valign="top">

<table align="center" valign="center" cellspacing="0" width="840px">

<tr valign="top" align="right">

<td width="180px" class="date" valign="center" style="padding-top:3px">

امروز:

<?php

echo $dateview

?>

</td>

<td width="70px" class="menu">

<a href="index.php" target="_blank" style="text-decoration:none; color:#FFF"> صفحه نخست </a>

</td>

<td width="65px" class="menu">

<a href="index.php?pid=10" target="_blank" style="text-decoration:none; color:#FFF">اخبار ویژه</a>

</td>

<td width="75px" class="menu">

<a href="index.php?pid=22" target="_blank" style="text-decoration:none; color:#FFF">سایر رسانه ها </a>

</td>

<td width="75px" class="menu">

<a href="index.php?pid=15" target="_blank" style="text-decoration:none; color:#FFF">گزارش تصویری</a>

</td>

<td width="35px" class="menu">

<a href="http://www.tehranshahr.org/rss.php" target="_blank" style="text-decoration:none; color:#FFF">فید </a>

</td>

<td width="75px" class="menu" >

<a href="index.php?pid=15" target="_blank" style="text-decoration:none; color:#FFF">همکاری با ما</a>

</td>

<td width="60px" class="menu" >

<a href="index.php?pid=16" target="_blank" style="text-decoration:none; color:#FFF">تماس با ما</a>

</td>

<td width="55px" class="menu" >

<a href="index.php?pid=17" target="_blank" style="text-decoration:none; color:#FFF">درباره ما</a>

</td>

<td width="45px" class="menu">

<a href="index.php?pid=18" target="_blank" style="text-decoration:none; color:#FFF">پیوندها</a>

</td>

<td width="70px"></td>

</tr>

</table>

</td>

<td height="21px" width="120px" style="background-image:url(image/s.jpg); background-repeat:no-repeat">

<form method="post" action="?pid=20">

<input align="bottom" type="text" id="keyword1" name="keyword" border="0" style="text-align:inherit; border:none;height:13px;width:112px;font-size:11px;margin-bottom:2px;margin-top:2px" />



</form>



</td>

<td height="21px" width="27px" style="background-image:url(image/sb.jpg); background-repeat:no-repeat" >

</td>

</tr>

</table>

</td>

</tr>


لطفا راهنمایی کنید
ممنون

mahdi_1986
دوشنبه 03 تیر 1392, 14:42 عصر
این خطا در مواقعی رخ می‌دهد که Session قبلا ارسال شده در جایی که Session_start() رو می نویسی این کد را بزار:


if (!isset($_SESSION)) session_start();

dousti_design
دوشنبه 03 تیر 1392, 14:53 عصر
با اجازه دوست عزیز mahdi_1986
به احتمال زیاد فایلتون حاوی BOM هست. با notepad++ بازش کنید و از منوی فرمت without BOM رو انتخاب و ذخیره کنید. و همینطور دقت داشته باشید که قبل از تایع session start هیچ خروجی نباید ایجاد کنید.