【问题标题】:XAMPP only lets me connect to index.php and not other pagesXAMPP 只允许我连接到 index.php 而不是其他页面
【发布时间】:2016-04-13 21:27:27
【问题描述】:

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

localhost:82 调出 index.php 文件(实际上它可以重定向到 index3.html)。我在那里输入我的密码,通常它会将我重定向到 localhost:82/home.php (并且它在我的另一台计算机上)但是在这台计算机上,它需要大约 10 秒的等待,然后我得到一个连接错误页面铬和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");
   }
?>

它在我的第一台电脑上运行良好,这是怎么回事?

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

编辑:这是我的 INDEX.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 logfile(s)php logfile(s) 和/或windows event log 中是否存在与问题相关的内容?
  • 在事件查看器中我有很多这些:错误的应用程序名称:httpd.exe,版本:2.4.18.0,时间戳:0x5667f02e 错误的模块名称:php7ts.dll,版本:7.0.1.0,时间戳:0x5671ed04 异常代码:0xc0000005 错误偏移量:0x0001ac04 错误进程 id:0x7f8 错误应用程序启动时间:0x01d14a9e618e67c3 错误应用程序路径:C:\xampp\apache\bin\httpd.exe 错误模块路径:C:\xampp\php\ php7ts.dll 报告 ID:a04d87bd-b691-11e5-be9b-d050990c9b8b 错误包全名:错误包相关应用程序 ID:
  • 在 apache 错误日志中突出显示:[ssl:warn] [pid 740:tid 372] AH01909: www.example.com:443:0 服务器证书不包含与服务器匹配的 ID名称
  • 您是使用“香草”XAMPP 安装还是添加/替换例如.dll 或类似的东西?
  • PHP 脚本不应该™ 能够导致杀死 apache 的访问冲突 (0xc0000005)。我会:a)检查硬盘 b)从(几乎)任何 linux cd 运行 memtest c)从头开始重新安装 xampp

标签: php xampp


【解决方案1】:

使用您喜欢的文本编辑器打开 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 并将其替换为 AllowOverride All

重启 Apache !

完成

【讨论】:

  • #LoadModule rewrite_module modules/mod_rewrite.so 已取消注释。 Override All 现在导致我的 apache 服务器无法启动。每次点击开始都会失败。
  • 不幸的是,这对我没有任何改变
  • 什么错误?我使用 localhost 访问 index.php,然后访问 index3.php,当我输入登录信息时,XAMPP 短暂失去了连接,我无法通过登录页面。
  • 抱歉,override all 并没有导致崩溃。但是将其更改为 All 并不能解决我的问题
  • 在事件查看器中我有很多这些:错误的应用程序名称:httpd.exe,版本:2.4.18.0,时间戳:0x5667f02e 错误的模块名称:php7ts.dll,版本:7.0.1.0,时间戳:0x5671ed04 异常代码:0xc0000005 错误偏移量:0x0001ac04 错误进程 id:0x7f8 错误应用程序启动时间:0x01d14a9e618e67c3 错误应用程序路径:C:\xampp\apache\bin\httpd.exe 错误模块路径:C:\xampp\php\ php7ts.dll 报告 ID:a04d87bd-b691-11e5-be9b-d050990c9b8b 错误包全名:错误包相关应用程序 ID:
猜你喜欢
  • 1970-01-01
  • 2013-07-11
  • 1970-01-01
  • 1970-01-01
  • 2015-11-22
  • 2018-04-05
  • 2012-09-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多