Error doing include Warning no such file or directory

0

This is the error:

  

Warning: include (/folder/file.php): failed to open stream: No such   file or directory in file.php on line 3

This is the code with which I get an error:

<?php session_start();  ?>
<!DOCTYPE html>
<html>
<?php include ("/miweb/template/head.php"); ?>
  <body class="container-fluid no-padding">
  <?php include ("/miweb/template/header.php"); ?>

  ... mas código

What I want to include is in the /miweb/template folder and the file I want to include it in /miweb/home

    
asked by Pavlo B. 11.11.2016 в 17:32
source

3 answers

3
<?php session_start();  ?>
<!DOCTYPE html>
<html>
<?php include ("../miweb/template/head.php"); ?>
  <body class="container-fluid no-padding">
  <?php include ("../miweb/template/header.php"); ?>

  ... mas código
?>

Relative routes

To access from miweb/home to /miweb/template/head.php , you have to put ../template/head.php .

    
answered by 11.11.2016 / 17:35
source
1

Try this code:

<?php session_start();  ?>
<!DOCTYPE html>
<html>
<?php include ("../miweb/template/head.php"); ?>
  <body class="container-fluid no-padding">
  <?php include ("../miweb/template/header.php"); ?>

.. Is to download directory . Refers to the same directory

    
answered by 11.11.2016 в 17:35
1

you are misdirecting

use. to move around in the tree of your project

<?php include ("../miweb/template/header.php"); ?>
    
answered by 11.11.2016 в 17:52