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

The Archive Base Latest Questions

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

if I have 2 scripts: includes/ajax_dir/script_1.php and includes/script_2.php From script_1.php I know I can

  • 0

if I have 2 scripts:

includes/ajax_dir/script_1.php

and

includes/script_2.php

From script_1.php I know I can include srcipt_2.php like so:

include("../script_2.php");

however how could i do this include using an absolute link?…

  • 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:35:02+00:00Added an answer on May 27, 2026 at 1:35 pm

    dirname(__FILE__)."/../" will work great I think.

    The reason I use dirname(__FILE__)."/somepath/ everywhere is:

    Imagine you have this folder structure

    • /
      • index.php
      • /includes
        • /includes/include_libs.php
        • /includes/db.php
    • /ajax
      • dostuff.php
    //index.php
    <?php
    include("includes/include_libs.php");
    
    
    // /includes/include_libs.php
    <?php
    include("includes/db.php"); //here is the problematical part
    
    // /ajax/dostuff.php
    <?php
    include("../includes/include_libs.php"); /** 
        this will cause that include_libs tries to include /ajax/includes/db.php instead of /includes/db.php, to fix this trouble, change the problematical line in includes_libs.php to 
    
        include(dirname(__FILE__)."/db.php");
    
    which will ensure that real db.php will be called */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have use include ('base.php') script in my other scripts ( more.php ). Now
I have a PHP script like this: <?php include 'authorization_script.php'; foreach ($_POST as $key
Within my HTML, I have a php script that includes a file. At that
I have a site on domainA.com. It includes file.js from domainB.com: <script type=text/javascript src=http://www.domainB.com/file.js></script>
I have a script snippet looks like below: <ItemGroup> <files Include=*.txt></files> </ItemGroup> <Message Text=@(files)>
I have a PHP script masquerading as JS in order to dynamically include and
I have a PHP script (news-generator.php) which, when I include it, grabs a bunch
I have a directory structure like the following; script.php inc/include1.php inc/include2.php objects/object1.php objects/object2.php soap/soap.php
I have a Scripts folder, that includes all the .js files used in the
I have a PHP script located in my Wordpress installation's root folder wordpress-root/includes/login.php When

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.