AndreasWT AndreasWT - 8 months ago 73
HTML Question

Xammp/php: cant find file path

I use brackets for editing and live previewing my code, but when I change the names of my folders live preview doesn't work. Here is the error message:

Warning: require(header.php): failed to open stream: No such file or directory in D:\Programmering\Xammp\Files\htdocs\webside1\pages\index.php on line 13
Fatal error: require(): Failed opening required 'header.php'

(include_path='D:\Programmering\Xammp\Files\htdocs\webside1\pages/../') in D:\Programmering\Xammp\Files\htdocs\webside1\pages\index.php on line 13

Here is my index.php code:

<!DOCTYPE html>
<title>Home - Awt-technologies</title>
<link rel="stylesheet" href="">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="style.css">
<script src=""></script>

<body id="indexbody">
<?php //include_once('D:\Programmering\Xammp\Files\htdocs\webside1\pages\header.php');
require 'header.php';
//Checks if user is logged in
if(isset($_SESSION['name'])) {
include_once "templates\loggedin.php";


I checked the path and it should work but doesn't. Here is a picture of my files in brackets:


Your index.php is in a different folder than your header.php file.

You'll need to change the require path to ../templates/header.php.