Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6945465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:26:22+00:00 2026-05-27T13:26:22+00:00

i receive this PHP Error whenever i try to include a php file in

  • 0

i receive this PHP Error whenever i try to include a php file in my index.php:

No such file or directory

At first i include this file at the beginning of the index.php: require_once("../resources/engine/settings.php");

And i get no error, but when i include the header file with require_once($TEMPLATES."/header.php");

I get that error.

$TEMPLATES is a variable that’s declared in settings.php (that is included correctly into index.php).

This is settings.php:

<?php

     $BASEURL = "http://localhost/webname";
     $CSSFolder = $BASEURL."/public/css";
     $CSS = $CSSFolder."/style.css";
     $IMGFolder = $BASEURL."/public/img";

     $ROOT = $_SERVER["DOCUMENT_ROOT"]."/webname";
     $TEMPLATES = $ROOT."/resources/templates";
     $ENGINE = $ROOT."/resources/engine";

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:26:22+00:00Added an answer on May 27, 2026 at 1:26 pm

    Instead of using $_SERVER['DOCUMENT_ROOT'], i always use dirname to get the root path defined, and id suggest you to use that also. If you use this all over the place, you’ll faster get rid of all the path traversing confusion that can arise with it.

    I find it easier to work with, like this

    $ROOT = dirname(__FILE__)."/webname";
    

    Although they seem to return the same, using DOCUMENT_ROOT returns the absolute path of where the script is executing, whereas the dirname call is absolute to where the file is located physically.

    Now to address your question:

    An easy way to debug includes like this is to actually just print out the path, which would be print $TEMPLATES."/header.php" and check whether that is what you expect it to be, if not, then correct it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

THE SUMMARY: When I call .../index.php/product, I receive: Fatal error: Call to a member
<?php require_once includes/db_data_inc.php; try { /* In this way I get a db connection
i have this error Parse error: syntax error, unexpected '{' in receive/register.php on line
I'm escaping all the string parameters I receive from a php form like this:
I receive this message (see image below) when I try to edit in debugging.
I have this mysql query using PHP and first part is working fine, but
I have this testing code in PAGE A : <?php require_once('../mysite/php/classes/eventManager.php'); $x=new EventManager(); $y=$x->loadNumbers();
I have a script called 'sess-start.php' which lies in an /include directory within my
Whenever I've received this error, I just increased the memory to fix it. I
I receive this Run-Time Check Failure upon the return in the following code. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.