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 7750587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:19:46+00:00 2026-06-01T11:19:46+00:00

When I require any PHP file in my index page I see an error:

  • 0

When I require any PHP file in my index page I see an error:

my config file :

define( "APP_ROOT", realpath( dirname( __FILE__ ) ).'/' );

my includes/require file put :

localhost/test/includes/

failing code and error :

require_once(APP_ROOT .'includes/test1.php');
require_once(APP_ROOT .'includes/test2.php');

failed to open stream: No such file or directory in C:\xampp\htdocs\test\includes\test.php on line 38

What is my problem? How can I fix this for any relative path.

  • 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-06-01T11:19:48+00:00Added an answer on June 1, 2026 at 11:19 am

    It looks like your file is being called from /test/includes, so APP_PATH is C:\xampp\htdocs\test\includes\, so your trying to require C:\xampp\htdocs\test\includes\includes/test1.php and so forth.

    Echo APP_PATH and see what it prints.

    Your better off making all the includes relative to each other, and then you only have to play games importing a single common.php file from your index.php

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

Sidebar

Related Questions

Is there any way to include php file using require and calling a php
I have a bootstrap file which is index.php and I only allow this page
I created a index.php file located in http://localhost/home/index.php . The file filled with the
I've got a file header.php which is require()'d in just about every file within
I am editing an index.php file in the themes folder and I just need
I have these three files to work with: document_root/include/config.php document_root/include/database.php document_root/index.php And the relevant
I have a PHP file for my website, index.php, which, as it stands on
My file structure: /holiday/admin/list.php /holiday/includes/functions.php # common functions /holiday/index.php # / is the document
Is there any way to use a php file in the parent folder. I
I am developing a web application. contents are: root dir (/var/www/) config.php index.php details.php

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.