XAMPP只允许我连接到index.php,而不能连接到其他页面


XAMPP only lets me connect to index.php and not other pages

我让XAMPP在一台计算机上运行得很好。然后我把它安装在另一个和使用相同的文件我有以下问题。

localhost:82打开index.php文件(实际上可以重定向到index3.html)。我在那里输入密码,通常它会将我重定向到localhost:82/home.php(在我的另一台计算机上也是如此),但在这台计算机上,它需要大约10秒的等待时间,然后我从chrome和IE中得到一个连接错误页面。我注意到这是由XAMPP apache服务器在返回绿色状态之前短暂变黄引起的。

我也无法直接连接到localhost:82/home.php。我也犯了同样的错误。

我在每个.php页面的开头都有这个。删除它并没有解决问题。

<?php 
   session_start();
 //Check to make sure the person is loggedin
   if (isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true) {
 //if logged in then do nothing
    } else {
 //if not logged int he redirect to the login page
   header("Location: http://localhost:82/index2.php");
   }
?>

它在我的第一台电脑上运行良好,这里发生了什么

==============================

编辑:这是我索引上的代码。PHP

<?php
//Connect to a database
$host_name  = "localhost";
$database   = "db608008888";
$user_name  = "ABC";
$password   = "123";
$connect = mysqli_connect($host_name, $user_name, $password, $database);

//Take the values from the html form and assign them to variables
$ID = $_POST['name'];
$userpassword = $_POST['password'];
//If no passsowrd entered then go straight to index.php
echo "<script type='text/javascript'>alert($userpassword);</script>";
if ($userpassword == null) {
  header("Location: http://localhost:82/index3.php");
  die();
}
//Check to see if the password matches the hashes
if (md5($userpassword) === '5b5c45f1b9e444d9e441211cfb325270' 
    or md5($userpassword) === '17434cf0d4ba816cd776ff8b0ec532f1' 
    or md5($userpassword) === '7a94fda2a6e81a1693533e6dc8501b37' 
    or md5($userpassword) === '2d8b2ba14eeb0ac1fe474d468b720771') 
{
//Add the visitor name to our list
  mysqli_query($connect, "INSERT INTO `visitor list` (`Visitor Name`) VALUES     ('$ID')") or die("Error in INSERT: ".mysqli_error($connect));

// Start the session so they can access other pages
  session_start();
  $_SESSION['loggedIn'] = true;
// Redirect them to rest of site
  header("Location: http://localhost:82/home.php");
  die();
 }
else {
  header("Refresh: 0; url=index2.php");
  echo "<script type='text/javascript'>alert('"Wrong Password. .'");</script>";
  }
 ?>

使用您喜欢的文本编辑器打开apache的配置文件。配置文件通常位于:

{apache_dir}/conf/httpd.conf

如果您正在使用XAMPP或WAMP软件包,那么您将在以下位置找到该文件:

{xampp_dir}/apache/conf/httpd.conf
{wamp_dir}/apache/conf/httpd.conf

搜索以下字符串:

#LoadModule rewrite_module modules/mod_rewrite.so

并取消注释(删除"#"符号)。现在搜索另一个字符串AllowOverride None,并将其替换为AllowOverwrite All

重新启动Apache!

完成