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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:07:39+00:00 2026-06-17T05:07:39+00:00

This bug has depleted my rational thinking power over the past 64 minutes and

  • 0

This bug has depleted my rational thinking power over the past 64 minutes and I really don’t know what I should do.

When i use the following 3 lines in an included file:

var_dump(file_exists('G:/xampp/htdocs/myproject/public_html/includes/htmlPurifierAndMarkdown.php')); //retuurns true
var_dump(__FILE__);
include '../htmlPurifierAndMarkdown.php'; //gives error

i get the following output :

boolean true

string 'G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php' (length=71)


( ! ) Warning: include(../htmlPurifierAndMarkdown.php) [function.include]: failed to open stream: No such file or directory in G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php on line 4
Call Stack
#   Time    Memory  Function    Location
1   0.0005  345328  {main}( )   ..\add.php:0
2   0.0036  382408  include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\events.class.php' )    ..\add.php:28
3   0.0041  398024  include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\standardpost.class.php' )  ..\events.class.php:2
4   0.0047  413928  include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php' )    ..\standardpost.class.php:2

In a nutshell:

  1. The first line tells that the file is not a part of my imagination and it actually exists.
  2. The second line tells the location of my calling script, on examining the paths closely, you’ll notice that the file I’m trying to include resides in the parent directory
  3. Include function says that file dosent exist

so am i just imagining stuff or is this some serious php bug?

Update

when i access genral.class.php manually, no error is generated. do special rules apply when including from within an included file?

Update 2

When i set the include path to ‘../includes/htmlPurifierAndMarkdown.php’ , which is the path relative to the main calling script, which in turn includes a script which includes genral.class.php it works, but since this new include is relative to only one of the many calling scripts, it breaks down for the others. Do special rules apply when including a file from within an included file??

  • 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-17T05:07:41+00:00Added an answer on June 17, 2026 at 5:07 am

    The __FILE__ constant returns the full path and filename of the file containing that line. It is possible for this file to be located inside a directory other than the current working directory. In your particular example you can use this:

    include dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'htmlPurifierAndMarkdown.php';
    

    An example of what might be going on is as follows:

    1. The file being executed is /example.com/public_html/index.php
    2. Current working directory is /example.com/public_html/
    3. The index file includes /example.com/public_html/includes/classes/genral.class.php
    4. The above file attempts to include ../htmlPurifierAndMarkdown.php
    5. The .. is translated relative to current working directory and not relative to the included file. Thus you end up with /example.com/htmlPurifierAndMarkdown.php and a nasty error message.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This really feels like a bug in Qt. Anyone has a solution or should
Does anyone know if this subversion bug has been dealt with? https://svn.apache.org/repos/asf/subversion/tags/1.6.9/www/faq.html#windows-access-denied I'm getting
I don't know if this is a bug with MySQL or my fault, but
UPDATE 2011.09.13 This bug has been resolved by Adobe. The example code below now
EDIT : As of 2012-06-11 this bug has been finally fixed! https://bugs.webkit.org/show_bug.cgi?id=35981#c1 I have
This code has an interesting bug: some_struct struct_array1[10] = {0}; some_struct struct_array2[10] = {0}
Edit : The bug that caused this problem has been fixed. The @version tag
Okay, so this bug has cost me quite a bit of time and embarrassment.
This bug has me perplexed. I am displaying a Widget with the last 5
I am somewhat new to Perl, and this bug has puzzled me for 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.