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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:25:18+00:00 2026-05-26T19:25:18+00:00

I am working on a php project and I am having problems with including

  • 0

I am working on a php project and I am having problems with including files.

I have a php script which is located at myapp/reports/index.php. When a form is submitted it performs an ajax post to another phpscript located at myapp/reports/phpHander/submit.php.

Submit.php then has to include a php script which is used to send an email. This is done to ensure that same code can be used over and over again without it needing to be typed for each time it is need. This php script is located at ../../administrator/classes/send.php.

Up to this point is working fine however the send.php script includes another file to get app config settings which is located in administrator/appConfig.php. The problem is this appConfig.php isn’t being found even if I put in the full web address of http://localhost/myapp/administrator/appConfig.php.

What am I doing wrong. I am using the php include function to do this and its working for everything else but it seems to have a problem then including another script from a different location.

Thanks for any help you can provide.

  • 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-26T19:25:19+00:00Added an answer on May 26, 2026 at 7:25 pm

    http://localhost/myapp/administrator/appConfig.php is only URL path.

    You need absolute filepath like C:/wamp/www/myapp/administrator/appConfig.php (Windows) or /var/www/myapp/administrator/appConfig.php (Linux)


    Anyways best way is make a file “dirs.php” in your root application directory with constant:

    define('ROOT_DIR', dirname(__FILE__));
    

    where dirname(__FILE__) will be absolute path to your app directory.

    With this knowledge you can include files in this way:

    myapp/reports/index.php:

    require_once('../../dirs.php');
    include(ROOT_DIR . '/administrator/appConfig.php');
    

    myapp/reports/phpHander/submit.php.:

    require_once('../../../dirs.php');
    include(ROOT_DIR . '/administrator/appConfig.php');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using MySQL and PHP for a project I am working. I have
I am currently working on a PHP project which includes extensive database usage. The
I'm having some problems with a project I'm doing using Google Maps. I have
I am working on a project using MySQL and PHP. I will have many
I am working on a PHP project where the client wants multipage form data
I am working on this PHP project and I have many places that an
I'm working on a PHP project with several developers, each who has their own
I am working on a php project that needs to store information about various
I'm working on a PHP project running on Windows and it would be so
I am working on a PHP project. There, I often use following syntax to

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.