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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:51:18+00:00 2026-05-14T06:51:18+00:00

config.php put at the root level, this file will be included in any pages.

  • 0

config.php put at the root level, this file will be included in any pages.

Then at config.php

<?php
define( 'ROOT_DIR', dirname(__FILE__) );
?>

So at all other pages from different sub/a.php , sub/sub/b.php directories, when I want to include a specific file in specific location, I just need to

include( ROOT_DIR.'/include/functions.php' );

In windows server, the ROOT_DIR bring the value to C:/inetpub/vhosts/domain.com

Is this a good/secure way?

It seems like via this way, when I move the b.php to other upper level folder, I don’t need to do any changes to the include file path, which is good for maintenance.

Any cons? Like SEO wise, or any other reason…
What you guys think.

  • 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-14T06:51:18+00:00Added an answer on May 14, 2026 at 6:51 am

    I will comment that one advantage to the method you’re using (using absolute paths) is that PHP won’t need to resolve the path for every request. You may see ever-so-slightly better performance that way.

    Also, if you’re using PHP 5.3, you can just use __DIR__ instead of dirname(__FILE__).

    If you’re not using 5.3, you might give it a shot if you can. A lot of improvements were made for the Windows platform in 5.3, not to mention the many new useful language features.

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

Sidebar

Related Questions

As many do I have a config.php file in the root of a web
I want something (final) like this : <?php //named as config.php $fn[0][long] = file
Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I
I'm writing a config file and I need to define if the process expects
I am using php and mysql. I have a Database config file (db-config.php) which
All of the pages and resources that php will give through readfile() exist in
Often while editing config files, I'll open one with vi and then when I
I have the following config in my lighttpd.conf: $HTTP[host] == trac.domain.tld { server.document-root =
I asked how to do this before but it seems I needed to put
I want to parse (in a special way) a CSS file with PHP. Example:

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.