更新XAMPP破坏了PHP网页执行

时间:2019-02-10 16:17:29

标签: php xampp htdocs

我使用Windows 10 64位桌面和Windows 10 64位笔记本电脑。两台计算机上都发生了这种情况。

完全卸载旧版本的XAMPP(在Admin帐户中)后,我以管理员身份重新安装了最新版本(xampp-win32-7.3.1-0-VC15-installer.exe),并且已禁用防火墙和病毒防护)。

我通过在Chrome浏览器中输入localhost /来验证安装,然后XAMPP网页出现在localhost / dashboard上。

然后我将数据库备份加载到phpMyAdmin 4.8.4中。然后将页面的备份文件夹复制到htdocs中。

但是现在在旧版本中正确显示的php网页现在在某些页面(而不是全部页面)上引发了此错误。

Warning: require_once(/includes/session.php): failed to open stream: No such file or directory in C:\xampp\htdocs\my_rabbits\my_profile.php on line 1

Fatal error: require_once(): Failed opening required '/includes/session.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\my_rabbits\my_profile.php on line 1

我检查了路径,它们都是正确的-没有拼写错误。我的include文件夹和单独的my_profile.php页面都位于htdocs中。这是my_profile.php页面的第1行:

<?php require_once("/includes/session.php"); ?>

这是我的include / session.php代码的样子:

<?php

   session_start();

   function message() {
      if (isset($_SESSION["message"])) {
         $output = "<div class=\"message\">";
         $output .= htmlentities($_SESSION["message"]);
         $output .= "</div>";

         // clear message after use
         $_SESSION["message"] = null;

         return $output;
      }
   }

   function errors() {
      if (isset($_SESSION["errors"])) {
         $errors = $_SESSION["errors"];

         // clear message after use
         $_SESSION["errors"] = null;

         return $errors;
      }
   }

?>

感谢您能提供的任何帮助。我是新手,正在未知的水域中航行...

1 个答案:

答案 0 :(得分:0)

php.ini中的

include_path-没有当前路径

include_path = ".;C:\xampp\php\PEAR"