PHP写的页面无法访问,报HTTP500错误,这个是怎么回事呀? PHP写的页面无法访问,报HTTP500错误,这个是怎么回事呀?最简单的PHP语句都不能显示 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 HTTP500是内部服务器错误,说明你的PHP代码中有问题,建议你把PHP的error_reporting打开error_reporting (E_ALL & ~E_NOTICE);看一下报错提示。 没用的,任何PHP代码都无法运行,我怀疑是服务器设置的问题,但是我这个是虚拟主机,无法改配置 代码很简单,就几句数据库操作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; } $result=$obj->exec($sqllog);这句中$obj是哪里来的,你在执行exec前,有对$obj进行new操作吗? 这个是包含在require_once('lib/auto_load.php');require_once('lib/islogin.php');这两句话里面的。 那有可能是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','')"; 代码一开始加error_reporting (E_ALL & ~E_NOTICE);看看是什么错误 还有检查require的那两个文件里面有没有语法错误,比如用了中文标点什么的。 加这个函数还是一样的,去掉前面require里面的两个文件也都是一样的报HTTP500错误,我怀疑是系统配置的问题 单建一个php文件,写下面的代码<?phpphpinfo();?>打开看看能显示出结果吗? HTTP 500错误一定是你的PHP代码有错误,PHP解释器执行不了。两个方法找错误1) 用有语法检查提示的编辑器,比如Eclipse打开你的文件看看有没有错误提示,注意require里面的文件也要检查2) 加error_log("error_message", 3, "log.txt");在你想输出信息的地方,用这种方式找代码哪句有问题。 这个问题解决,但是又出现MYSQL插入数据库成???乱码的问题了 求助 PHP验证码 @符号 php,数组拷贝 一个数组,怎么找到乘积小于某一个数的组合,并保留 php中,dom解析xml文件,乱码问题 asp与php冲突问题 求教一个功能 请问这段代码做了什么?谢谢 PHPLib的安装使用问题,大家指点一下 为什么提交php表单时得不到数据? 为什么我下载的apache_1.3.19 for win32 没有安装程序啊?一个.exe的文件都没有 如何解决用户通知邮件被gmail,yahoo当做垃圾邮件 结构式查询是怎么实现的?
error_reporting (E_ALL & ~E_NOTICE);
看一下报错提示。
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;
}
这句中$obj是哪里来的,你在执行exec前,有对$obj进行new操作吗?
这个是包含在require_once('lib/auto_load.php');require_once('lib/islogin.php');
这两句话里面的。
$sqllog="insert into ibinfo(name,tel,mail,region,im,experience,custom,re,createtime,updatetime) values ('$name','$telephone','$mail','$region','$im','$experience','$custom','$re','$date','')";
error_reporting (E_ALL & ~E_NOTICE);
看看是什么错误
加这个函数还是一样的,去掉前面require里面的两个文件也都是一样的报HTTP500错误,我怀疑是系统配置的问题
<?php
phpinfo();
?>打开看看能显示出结果吗?
1) 用有语法检查提示的编辑器,比如Eclipse打开你的文件看看有没有错误提示,注意require里面的文件也要检查
2) 加error_log("error_message", 3, "log.txt");在你想输出信息的地方,用这种方式找代码哪句有问题。