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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:58:45+00:00 2026-06-09T15:58:45+00:00

I am working on a web application that uses PHP and JavaScript and I

  • 0

I am working on a web application that uses PHP and JavaScript and I have some troubles accessing some pages that are not on the root if they are including other files (ie. ‘include once’).

[file system]/www/project/test/test.php

The project folder has the index.php. Here is an example of my code:

include_once('../config/config.php');
include_once('../database/database.php');
echo 'Test.php';

$config = new Config();
$dbhandle = new Database();

[...]

What am I doing wrong here?

The error log from Apache tells me that there is no file config.php and database.php.

  • 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-09T15:58:47+00:00Added an answer on June 9, 2026 at 3:58 pm

    use $_SERVER[‘DOCUMENT_ROOT’] to relocate the path to the root path of your server like this :

     $root_path =  $_SERVER['DOCUMENT_ROOT'] ; //Returns the root path of your server
    
     //Then call your inlude_once with the absolute path
     include_once($root_path . '/project/config/config.php')
    

    So now all your path are Absolute and not relative.
    Hope that helps.

    PS : You can also get confortable using a php framework that will do the magic of routing your dependencies easier on a bigger project.

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

Sidebar

Related Questions

I have a working web application that uses username/password SpringSecurity configuration. Now I want
I am currently working on a web application that uses PHP and MySQL, but
I have a web application that I am currently working on that uses a
I am working on a pyramid web application that uses SQLAlchemy. I have a
I am working on an web application that uses themes and different master pages.
I'm working on an ASP.NET web application that uses a lot of JavaScript on
I am working on web application that will use PHP & MySQL. Application will
i m working on a web application that reads files from some where and
I'm working on a web application that has a lot to download (javascript, images,
I'm working on a web application that will have a custom UI for the

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.