标题: 【求助】??PHP在执行后是一片空白???
银色永逸
新生入学
Rank: 1
注册用户



UID 149865
精华 0
积分 0(积分有什么用?)
帖子 14
阅读权限 10
注册 2006-2-17
状态 离线
发表于 2006-2-17 15:11  资料  个人空间  短消息  加为好友 
【求助】??PHP在执行后是一片空白???

环境:Red Hat Enterprise Linux 4(含apache+MySQL)

运行后 可以正常调试出 <? phpinfo(); ?>

但其他PHP文件都是一片空白,查看IE浏览器中的页面只有如下代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8"></HEAD>
<BODY></BODY></HTML>

用编辑器查看PHP文档源码正常,就是不执行**************************************???

有谁能解释啊?

顶部
yqg87
新生入学
Rank: 1
注册用户



UID 142507
精华 0
积分 0(积分有什么用?)
帖子 16
阅读权限 10
注册 2005-11-21
状态 离线
发表于 2006-2-17 15:37  资料  个人空间  短消息  加为好友 
请给出你所要查看的PHP文件的源代码,以供参考!

顶部
不容错过的IBM 集群技术资源汇总
银色永逸
新生入学
Rank: 1
注册用户



UID 149865
精华 0
积分 0(积分有什么用?)
帖子 14
阅读权限 10
注册 2006-2-17
状态 离线
发表于 2006-2-17 17:12  资料  个人空间  短消息  加为好友 
出现空白页面的源码如下:

<?php

$showErr = false;
if (isset($_POST['username'])) {
        $pass = md5($_POST['password']);
        $sql = "SELECT * FROM user WHERE username='{$_POST['username']}' and password='$pass'";
        $result = execQuery($sql, BASEDB);
        $data = mysql_fetch_assoc($result);
        if (!$data) {
                $sql = "INSERT INTO `loginlog` (userid, logtime, ip) VALUES ('0', now(), '{$_SERVER['REMOTE_ADDR']}')";
        } else {
                $sql = "INSERT INTO `loginlog` (userid, logtime, ip) VALUES ('{$data['userid']}', now(), '{$_SERVER['REMOTE_ADDR']}')";
        }
        execQuery($sql, BASEDB);
        if ($data) {
                session_start();
                //session_register('user');
                $_SESSION['user'] = $data['username'];
                $_SESSION['flag'] = $data['flag'];
                if ($_POST['lang'] != 'default')
                        $_SESSION['code'] = $_POST['lang'];
                else
                        $_SESSION['code'] = $data['code'];               
                $_SESSION['realname'] = iconv(SYSCHARSET, $_SESSION['code'], $data['realname']);
                $_SESSION['store'] = '1';
                echo "**********window.location = \"out.php\";</script>";
                exit();
        } else {
                $showErr = true;
        }
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><?php echo iconv('GB2312', 'UTF-8', '页面')?></title>
</head>
<body onload="document.form1.username.focus();">
<form name="form1" method="post" action="">         
<table width="100%" height="90%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="56%" height="150" align="right" style="border-right:2px solid #990000 "><img src="images/indextitle.gif" width="400" height="88"></td>
        <td style="padding-left:20px" width="44%">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                <tr>
            <td height="2"></td>
            </tr>
          <tr>
            <td><img src="images/log_03.gif" width="58" height="18">
            <input name="username" type="text" size="15" class="textfield" maxlength="16">
            </td>
          </tr>
          <tr>
            <td style="color:#FFCC00"><img src="images/log_06.gif" width="58" height="18">
            <input name="password" type="password" size="15" class="textfield" maxlength="16"><?php if($showErr) echo iconv('GB2312', 'UTF-8', '密码错!'); ?></td>
          </tr>
          <tr>
            <td height="30">         
              <input name="imageField" type="image" src="images/login.gif" width="39" height="15" border="0">
        
<input name="imageField" type="image" src="images/reset.gif" width="39" height="15" border="0" onClick="document.form1.reset();return(false);"></td>
            </tr>
            <tr>
                   <td>
                            <input type="radio" name="lang" value="default" checked><?php echo iconv('GB2312', 'UTF-8', '默认');?>    
                          <input type="radio" name="lang" value="GB2312"><?php echo iconv('GB2312', 'UTF-8', '简体');?>
                              <input type="radio" name="lang" value="BIG5">繁体
                   </td>
           </tr>
        </table></td>
      </tr>
    </table></td>
    </tr>
</table>
</form>
</body>
</html>

******************************MSN: coco@scn.com.cn  可以交流编程技巧

顶部
davi
特聘作家
Rank: 5Rank: 5
荣誉版主



UID 25647
精华 9
积分 1(积分有什么用?)
帖子 4261
阅读权限 10
注册 2002-9-29
状态 离线
发表于 2006-2-17 21:50  资料  个人空间  短消息  加为好友 
看看你的phpinfo
在php程序里面逐行加echo测试一下哪里有问题

顶部
yqg87
新生入学
Rank: 1
注册用户



UID 142507
精华 0
积分 0(积分有什么用?)
帖子 16
阅读权限 10
注册 2005-11-21
状态 离线
发表于 2006-2-17 22:46  资料  个人空间  短消息  加为好友 
给我的感觉是数据库连接 的问题 我建议你编写一个简单的测试连接的页面!

顶部
不容错过的IBM 集群技术资源汇总
Roc.Ken
版主
Rank: 7Rank: 7Rank: 7



UID 47703
精华 86
积分 66(积分有什么用?)
帖子 5926
阅读权限 100
注册 2003-6-6
来自 hostpry.org
状态 离线
发表于 2006-2-19 12:10  资料  个人空间  主页 短消息  加为好友  ICQ 状态
直接在终端用php  file.php 也可看到运行的结果

顶部
不容错过的IBM 集群技术资源汇总
ust
新生入学
Rank: 1
注册用户



UID 43181
精华 0
积分 0(积分有什么用?)
帖子 18
阅读权限 10
注册 2003-4-25
来自 shenzhen
状态 离线
发表于 2006-2-24 15:00  资料  个人空间  短消息  加为好友 
屏蔽函数//exit();看是否有输出.
不加SESSION看有没有输出
楼上几位说的也是很对的,搞个简单的试试或ECHO来执行一步步找到原因.
另外在PHP.INI把错误输出打开,对调试是很有用的.wq





):
顶部
不容错过的IBM 集群技术资源汇总
ust
新生入学
Rank: 1
注册用户



UID 43181
精华 0
积分 0(积分有什么用?)
帖子 18
阅读权限 10
注册 2003-4-25
来自 shenzhen
状态 离线
发表于 2006-2-24 15:04  资料  个人空间  短消息  加为好友 
按错了,怎么发出去了?
接上贴:
我运行了你的代码:出现错误提示:

Fatal error: Call to undefined function: iconv() in D:\apache\Apache2\htdocs\test\20060224.php on line 36
一个函数未定义.如果你把错误输出打开是能够看到的,否则是什么也没有





):
顶部
 



当前时区 GMT+8, 现在时间是 2008-5-17 09:22

    Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.086762 second(s), 5 queries

清除 Cookies - 联系我们 - Linux伊甸园 - Archiver - WAP