0
votes

Im very new to php and i have a page with 5 includes located in a directory (called includes) one above where my page is held (called contact

My File Structure is like this

|Index.php (includes workfine)

|Includes

|Contact|index.php

The Index.php in the contact folder only seems to show the form2.php include

 <?php include("../../head.php"); ?>

</head>

<body>

 <?php include("../../header.php"); ?>

<!-- container -->

<div id="container" class="container_12">

<!-- full width Header-->
 <?php include("../../billboard.php"); ?>

  <!-- Main Content-->

  <div class="grid_8">



 <?php include("../form2.php"); ?>





<div class="clear"></div>

</div> <!--main content close-->


<!-- Side Bar-->

 <?php include("../../sidebar1.php"); ?>





</div>


</div>
<!--containter close-->

<div id="topspace" class="grid_12"></div>
<?php include("../footer.php"); ?>
</body>
</html>

Errors that appear:

Warning: include(../../head.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 20

Warning: include(../../head.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 20

Warning: include() [function.include]: Failed opening '../../head.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 20

Warning: include(../../header.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 26

Warning: include(../../header.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 26

Warning: include() [function.include]: Failed opening '../../header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 26

Warning: include(../../billboard.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 33

Warning: include(../../billboard.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 33

Warning: include() [function.include]: Failed opening '../../billboard.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 33 Need To Talk About A Mortgage? We Can Contact You..

(form2.php appears here)

Warning: include(../../sidebar1.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 54

Warning: include(../../sidebar1.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 54

Warning: include() [function.include]: Failed opening '../../sidebar1.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 54

Warning: include(../footer.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 67

Warning: include(../footer.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 67

Warning: include() [function.include]: Failed opening '../footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 67

I have access to two servers and have tried uploading to both and both times get the error

What am i missing? Thanks

2
The files do not exist in the location you are referencing them.alex
It looks like you have an extra ../ on the paths of the broken includes — currently they're referencing files in the public_html directory, which I'm guessing is incorrect.Jon Gauthier

2 Answers

3
votes

If it's one directory above, use ../ instead of ../../

Example:

<?php include("../head.php"); ?>

That is why the form appears and the others don't :)

1
votes

Looks like you forgot to put the "/Includes/" in your paths

<?php include("../Includes/head.php"); ?>