Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Strange behaviors with include files

Explorer ,
Sep 03, 2011 Sep 03, 2011

Copy link to clipboard

Copied

Hi all,

I am facing a strange behavior with some of my files:

In one of my PHP file, I asked to require_once() a file that is located in my include_path directory and it "seems" to be working but when I click on the related files listed beside my PHP file, I get the [ "include_file".php is not on the local disk. Get ] error. I say it seems to work because I can also see another related file (to "include_file".php) also listed there.

In a more involded file where more "required" files are called upon, I can even see tha same file listed twice.

How can that be?

I was under the impression that my server looks into the Include_path first and then in the local web directory if a the file wasn't found. Doesn't Dreamweaver do the same? And if so why would Dreamweaver be able to read a file it cannot find?

Hardware: MacBook Pro

OSX 10.6.8 (Snow Leopard)

Dreamweaver CS5

using MAMP 1.9.5

     PHP include_path: .:/Applications/MAMP/bin/php5.3/lib/php

     Site_root: /Users/publi-script-I/Sites/site_root

Any help would be more than welcome

TIA

TOPICS
Server side applications

Views

678
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 03, 2011 Sep 03, 2011

Copy link to clipboard

Copied

You'll see it there twice if another supporting file is referencing it I believe. But, there shouldn't be any need for a second file to reference the include if it's already being done on the main page. Can you provide more details about this? The error may be a result of a conflict there, not sure.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 03, 2011 Sep 03, 2011

Copy link to clipboard

Copied

On the main file I have:

     require_once('a.php');

on a.php I have:

     require_once('b.php');

The problem I seem to be having is that Dreamweaver, while reading the include file from the include_path driectory (how else could it know about other dependencies) is showing a.php as being missing.

That is on the simple scenario

On the more complex scenario, in the b.php, I have:

     require_once('a.php');

In that case, a.php gets listed twice in the related files... Clicking on the first one, I get the [ a.php is not on the local disk. Get ] error, clicking on the second instance displays the containing code.

All required files are coded in the same fashion. Like I said, I was under the understanding that Dreamweaver looks for files under PHP's include_path directory FIRST than under the website_root if it did not find the file.

In this case, it appears that some files do find the the related file in the include_path directory while other s are looking in the website_root. This would account for seeing the file twice in the dependencies but not why or how this can happen.

What really puzzles me is the simple scenario where the file gets read (showing dependencies) but appears to be missing.

Moving my required file solves the problem but I still do not know why this is happening.

Note: The required files in question comes form the PEAR Spreadsheet_Excel_Writer package... If that adds anything to the problem.

TIA

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Sep 03, 2011 Sep 03, 2011

Copy link to clipboard

Copied

LATEST

This is a little over my head, so I hope someone with more PHP experience posts. But it doesn't seem valid to have the two include files including each other. I don't know about if the server looks elsewhere if it doesn't find an include.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines