PHP写的页面无法访问,报HTTP500错误,这个是怎么回事呀?最简单的PHP语句都不能显示

解决方案 »

  1.   

    HTTP500是内部服务器错误,说明你的PHP代码中有问题,建议你把PHP的error_reporting打开
    error_reporting (E_ALL & ~E_NOTICE);
    看一下报错提示。
      

  2.   

    没用的,任何PHP代码都无法运行,我怀疑是服务器设置的问题,但是我这个是虚拟主机,无法改配置
      

  3.   

    代码很简单,就几句数据库操作
    require_once('lib/auto_load.php');require_once('lib/islogin.php');
    $name=chkstring(addslashes(trim($_POST['name'])));
    $telephone=chkstring(addslashes(trim($_POST['telephone'])));
    $mail=chkstring(addslashes(trim($_POST['mail'])));
    $region=addslashes(trim($_POST['region']));
    $im=chkstring(addslashes(trim($_POST['im'])));
    $experience=addslashes(trim($_POST['experience']));
    $custom=addslashes(trim($_POST['custom']));
    $re=chkstring(addslashes(trim($_POST['re'])));
    $date=date('Y-m-d H:i:s', time());
    $sqllog="insert into ibinfo(IBid,name,tel,mail,region,im,experience,custom,re,createtime,updatetime) values ('','$name','$telephone','$mail','$region','$im','$experience','$custom','$re','$date','')";
    //echo $sqllog;
    //exit;
    $result=$obj->exec($sqllog);
    if($result)
    {
     
    echo "<script language=javascript>alert('IB信息成功录入!');document.location.href=('/index.html');</script>";
    exit;
      }
    else
    {
    echo "<script language=javascript>alert('录入失败,请与顾问联系!');document.location.href=('/index.html');</script>";
    exit;
    }
      

  4.   

    $result=$obj->exec($sqllog);
    这句中$obj是哪里来的,你在执行exec前,有对$obj进行new操作吗?
      

  5.   


    这个是包含在require_once('lib/auto_load.php');require_once('lib/islogin.php');
    这两句话里面的。
      

  6.   

    那有可能是SQL语句执行有问题,IBid字段是不是自增的?如果是自增的,insert的时候这个是不能插入空值的,改成
    $sqllog="insert into ibinfo(name,tel,mail,region,im,experience,custom,re,createtime,updatetime) values ('$name','$telephone','$mail','$region','$im','$experience','$custom','$re','$date','')";
      

  7.   

    代码一开始加
    error_reporting (E_ALL & ~E_NOTICE);
    看看是什么错误
      

  8.   

    还有检查require的那两个文件里面有没有语法错误,比如用了中文标点什么的。
      

  9.   


    加这个函数还是一样的,去掉前面require里面的两个文件也都是一样的报HTTP500错误,我怀疑是系统配置的问题
      

  10.   

    单建一个php文件,写下面的代码
    <?php
    phpinfo();
    ?>打开看看能显示出结果吗?
      

  11.   

    HTTP 500错误一定是你的PHP代码有错误,PHP解释器执行不了。两个方法找错误
    1) 用有语法检查提示的编辑器,比如Eclipse打开你的文件看看有没有错误提示,注意require里面的文件也要检查
    2) 加error_log("error_message", 3, "log.txt");在你想输出信息的地方,用这种方式找代码哪句有问题。
      

  12.   

    这个问题解决,但是又出现MYSQL插入数据库成???乱码的问题了