为什么这个页面在PHP5.3下不能正常的被执行?  就是访问后很慢,超级慢,状态栏一直显示该页面没有执行完.. 
我这个页面是以前在PHP5.2下做的, 再放到PHP5.3下运行就不成了..list.php
<?php
include("conn.php");
include("head.php");
?>
<html> <head>
<title></title>
</head> <body>
  <table border="0" align="center" width="500" cellpadding="5" cellspacing="1" bgcolor="#add3ef">
<?
$sql="select * from message order by id desc";
$query=mysql_query($sql,$conn);
while($row=mysql_fetch_array($query)){
?>
<tr bgcolor="#eff3ff">
<td>标题:<?=$row[title]?>
用户:<?=$row[user]?>
</td>
</tr>
<tr bgcolor="#ffffff">
<td>
内容:<?
//调用conn.php中的htmtocode函数,过滤替换文件内容
echo htmtocode($row[content]);
?>
</td>
</tr>
<?
}
?>
  </table> </body>
</html>conn.php
<?php
$conn = @mysql_connect("127.0.0.1","note","123456") or die("数据库连接出错");
mysql_select_db("simplenote",$conn);
mysql_query("set names 'GBK'");  function htmtocode($content){
$content = str_replace("\n", "<br>", str_replace(" ", "&nbsp;", $content));
return $content;
}
?>
head.php (这个页面是正常的,里面没有包含PHP代码)
<html> <head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head> <link href="images/css.css" rel="stylesheet" type="text/css">
<b>
<a href="add.php">添加留言</a> |
<a href="list.php">浏览留言</a> |
<a href="login.php">登陆</a>
</b>
<hr size="1"></html>

解决方案 »

  1.   

    1.php5.3默认关闭的了短标签
    2.看php5.3的php.ini配置中,mysql打开了吗
    3.mysql_connect前面的@链接去掉,看有什么错误
    4.是否mysql版本过低,链接不上,换一个mysql版本
      

  2.   

    select * from message order by id desc这个结果多少条记录?
      

  3.   

    如果程序代码无任何改变,硬性配置也依旧,那么数据多少跟PHP版本应该没什么关系!很有可能是短标签问题!把PHP标签写完整了或者PHP.ini里打开短标签!
      

  4.   

    另外取值时,$row[title]这种的获取效率不高,改为:$row['title'] 这样试试!其他字段一样处理!
      

  5.   


    //开启报错级别
    error_reporting(E_ALL);
    //error_reporting(7);
    在页面最顶部加入这个,就知道错误原因了