我正在使用apache 2.2
。我写了这段代码,当我试图运行它时,我的浏览器无法运行它,它显示
This webpage is not available
The connection to localhost was interrupted.
Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
以下是我的 php 代码:
<?php
error_reporting(E_STRICT | E_ALL);
include_once $_SERVER['DOCUMENT_ROOT'].'/include/db.inc.php' ;
$sql="select post_id,post_title,post_desc,post_date,course,semester,firstname,lastname FROM wbut_forum_posts left join users on post_by = email ORDER BY post_id DESC LIMIT 25";
$result = mysqli_query($link,$sql );
if (!$result)
{
include_once "wall.html.php";
echo'<tr><td align="center"> OOOOPPPPPSSS!!!SORRY,UNABLE TO DISPLAY LATEST 25 TOPICS</td></tr>';
exit();
}
$allposts = array();
while ($row = mysqli_fetch_array($result))
{
$allposts[] = array( 'p_id' => $row['post_id'],'p_title' => $row['post_title'],'p_desc' => $row['post_desc'],'p_date' => $row['post_date'],'p_course' => $row['course'],'p_semester' => $row['semester'],'p_firstname' => $row['firstname'],'p_lastname' => $row['lastname']);
}
foreach ($allposts as $posts) :
?>
<table border="0" cellpadding="0px" cellspacing="0px">
<tr>
<td align="left"> <span class="style5"><?php echo $posts[p_firstname] . " " . $posts[p_laststname] ; ?></span></td>
<?php
$id=urlencode($posts[p_id]);
$title=urlencode($posts[p_title]);
$date=urlencode($posts[p_date]);
$course=urlencode($posts[p_course]);
$semester=urlencode($posts[p_semester]);
$firstname=urlencode($posts[p_firstname]);
$lastname=urlencode($posts[p_lastname]);
?>
<td align="center" >
<a href="view.html.php?id=<?php echo "$id" ?>&title=<?php echo "$title" ?>&date=<?php echo "$date" ?>&course=<?php echo "$course" ?>&semester=<?php echo "$semester" ?>&firstname=<?php echo "$firstname" ?>&lastname=<?php echo "$lastname" ?>&" title="VIEW POST">
VIEW THE FULL POST AND REPLY HERE
</a>
</td>
</tr>
<tr>
<td> </td>
<td>
<span class="style6"><?php echo $posts[p_title] ; ?></span>
</td>
</tr>
<tr>
<td align="right"><?php echo $posts[p_date] ; ?></td>
<td align="center">
<PRE>RELATED COURSE : <span class="style7"><?php echo $posts[p_course] ; ?></span> AND RELATED SEMESTER : <?php echo $posts[p_semester] ; ?></PRE>
</td>
</tr>
<tr>
<td> </td>
<td><span class="style17"><?php echo $posts[p_desc] ; ?></span></td>
</tr>
</table>
<?php endforeach; ?>
错误:
此网页不可用 与 localhost 的连接已中断。错误 101 (net::ERR_CONNECTION_RESET): 连接已重置。 这是我的 Apache 的问题吗?如果是,那么如何修复它?
答案1
这是一条 Google Chrome 错误消息 - 也就是说,它肯定与您的 PHP 代码无关。
您没有提供任何有关此问题在哪个操作系统上运行的信息。这种情况在 Microsoft Windows 上发生的频率令人担忧,并且有几种产品作为反恶意软件出售。
你的 Apache 错误日志里有什么内容吗?防火墙日志?
进一步调查的最佳方法是使用数据包分析器(例如 wireshark)查看数据流,但您必须知道正在查看什么。