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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:17:59+00:00 2026-06-07T03:17:59+00:00

I tried to create a bootstrap file, but whenever I try to include or

  • 0

I tried to create a bootstrap file, but whenever I try to include or require it in another file an error like this keeps showing up:

Warning: require_once(../folder/file.php) [function.require-once]: failed to open stream: No such file or directory in…

Fatal error: require_once() [function.require]: Failed opening required ‘../folder/file.php’ (include_path=’.:’) in…

To paint the entire scenario:
I have a bootstrap file, load.php. In it, I connect to the config file at ../config/config.php. Above the load file I have a database class file at classes/database.php. In the database file I wrote this if-statement:

           if ( file_exists('../load.php') ) {
               echo 'load.php: It exists';
               require_once('../load.php');
           } else {
                  echo 'load.php: It does not exist';
                  }

In the load file I wrote a similar if-statement, but checking if the config file exists. Surprisingly, when I load the database.php file I get:

load.php: It exists
config.php: file doesn't exist

But when I load the load.php file and I get:

config.php: It exists

Here is where my files are located:

Root Directory: /Library/WebServer/Documents/project

config.php file /Library/WebServer/Documents/project/config/config.php

load.php file: /Library/WebServer/Documents/project/includes/load.php

database.php file: /Library/WebServer/Documents/project/includes/classes/database.php

I need help with this bug.
Thanks,

  • 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-07T03:18:01+00:00Added an answer on June 7, 2026 at 3:18 am

    use dirname(__FILE__) . '../relative/path/from/file/in/which/opened/to/config.php'. From PHP 5.3 there is also __DIR__ constant

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

Sidebar

Related Questions

I have tried create this table, but nothing I have tried works from FKs.
I tried to create jar file using command line that I inserted into java
I tried to create this by following the video at http://www.asp.net/learn/videos/video-7026.aspx where Joe Stagner
I need to create a bootstrap for my WiX project I've tried using setupbld.exe
I'm trying to create a topbar using twitter bootstrap, but the black bar won't
I'm new to doctrine. I created an bootstrap file like the following one: require_once(dirname(__FILE__)./../conf/general.php);
I tried to install python below way. But this did not work. This take
Tables in my database are created with a correct UTF-8 charset like this: CREATE
Tried to create a mobile navigation using dataview or outline and the view renders
I tried to create base controller and write in it: Ext.define('My.Users.controller.Role', { extend :

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.