【发布时间】:2020-09-24 17:26:58
【问题描述】:
我正在尝试打开 index.php 页面,但浏览器显示此错误: 目前无法处理此请求。 HTTP 错误 500
我不认为错误出现在 config.php 页面上,因为数据库配置适用于 index.php 以外的页面
这是我的 index.php 代码:
<?php
require_once 'config.php';
login_required();
$users = count_query("SELECT COUNT(*) AS num FROM users");
$emails = count_query("SELECT COUNT(*) AS num FROM subscribers");
$subs = count_query("SELECT COUNT(*) AS num FROM subscriptions");
$nls = count_query("SELECT COUNT(*) AS num FROM newsletters");
$mess = count_query("SELECT COUNT(*) AS num FROM messages");
$temps = count_query("SELECT COUNT(*) AS num FROM templates");
$title = "Home!";
$content = <<<EOF
<h3>current stats</h3>
<p>$users user registered</p>
<p>$emails subscribers</p>
<p>$subs newsletter subscriptions</p>
<p>$nls newsletters</p>
<p>$mess messages</p>
<p>$temps templates</p>
EOF;
include 'layout.php'; ?>
布局页面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title; ?> » my newsletter app</title>
<!-- Stylesheets -->
<!-- <link rel="stylesheet" href="media/style.css" type="text/css" media="all" /> -->
</head>
<body<?php if ($mini == true) { ?> class="mini"<?php } ?>>
<div id="header">
<h1><a href="index.php">my newsletter app</a></h1>
</div>
<?php if ($nonav == false) { ?>
<div id="nav">
<a href="messages.php"<?php if($tab == 'mess') {?>class="current"<?php } ?>>messages</a>
<a href="subscribers.php"<?php if($tab == 'sub') {?>class="current"<?php } ?>>subscribers</a>
<a href="newsletters.php"<?php if($tab == 'nl') {?>class="current"<?php } ?>>newsletters</a>
<a href="templates.php"<?php if($tab == 'temp') {?>class="current"<?php } ?>>templates</a>
<span class="right">
<a href="logout.php">log out</a>
</span>
</div>
<?php } ?>
<div id="container">
<h3><?php echo $title;?></h3>
<?php echo $content; ?>
</div>
</body>
</html>
配置页面:
<?php
// DB Settings
define('DB_SERVER', 'localhost');
define('DB_USER', 'abdulsme_admin');
define('DB_PASSWORD', 'bypass');
define('DB_NAME', 'abdulsme_newsletter');
define('FROM_EMAIL', 'no_reply@ohyeahemail.com');
define('FROM_NAME', 'oh yeah email!');
session_start();
require_once 'classes.php';
$mini = false;
$nonav = false;
error_reporting(0);
?>
【问题讨论】:
-
如果你删除所有代码,只写你好呢?
-
只写你好就可以了
-
查看服务器日志,让我们知道,以便我们为您提供帮助:)
-
太棒了!!您逐步检查以确定错误的确切位置。 1.通过添加configphp 2.添加索引页面代码的其余部分3.并通过添加layout.php
-
如何查看服务器日志?
标签: php