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

  • Home
  • SEARCH
  • 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 8289251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:27:54+00:00 2026-06-08T12:27:54+00:00

My PHP application has different config files with their different settings and their different

  • 0

My PHP application has different config files with their different settings and their different paths. But all of them need to access to just one database connection file. I would like to avoid mention its path separately on them with many ../ and ../../. How can I write a same code and use it in all of them?
Imagine that my PHP application has this hierarchy for its config files:

root
root/config/db.php (This file is what I want to mention from all config files.)
root/admin/config/conf.php
root/users/conf.php

Actually what I need is something that detect the root path of my project and create a same directory path generally.

  • 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-08T12:27:56+00:00Added an answer on June 8, 2026 at 12:27 pm

    Use $_SERVER['DOCUMENT_ROOT'] and then path to your file.

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

Sidebar

Related Questions

I have a php application that has about 50-55 code files. The file that
We have a php/mysql based application which has slightly different instances for a number
We are working with a PHP application which has no concept of switch-able themes;
Has anyone seen this error when working with a PHP application out of dynamic
In part of my PHP application, I need to make an REST style API
As the title suggests, I've inherited a php/MySQL application which has fairly well written
The web application has following prerequisites: Written in PHP Several menues, also a hierarchy
Is it possible to build a Java web application which has a PHP front
I have a PHP application containing multiple modules and various settings within each module.
I have a Zend Framework (PHP) web application that has a table with a

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.