Hi,

I am at my wit's end. We had to move servers, I have copied everything over to a new directory. in php.ini I have changed the include_path to be what I believe it should be, but I keep getting errors.

In any event,

The include path I have is:

include_path = ".;C:\Inetpub\vhosts\massvacation.com\httpdocs\htdocs2007Launch"

which is also the root of the site.

in that folder is the _includes directory which I call like so

<? include($_SERVER['document_root]."_includes..."); ?>

The errors I get are as follow:

Failed opening '/_includes/shared/ieStyles.php' for inclusion (include_path='.;C:\Inetpub\vhosts\massvacation.com\httpdocs\htdocs2007Launch') in C:\Inetpub\vhosts\massvacation.com\httpdocs\htdocs2007Launch\Index.php on line 37

    it does not make much use to have server root in include.

    index.php or any other page in this dircetory can simple include
    any file in this dirctory,with include('file');

    include_path = ".;xxxx;yyyyy"
    each path is separated with semicolon;

    the first is a dot . then xxx then yyyy

    The dot stands for same directory as the calling script.
    If index.php is in root, the dot means the root directory of server.

    If you want to include a file from a subdirectory = '_includes', from your index.php
    just use:

    include( '_includes/filename.php' );
    without a slash in front

    this work also for a sub(-child) directory ( dot means current directory ):
    include( './_includes/filename.php' );

    to include a file from parent directory:
    include( '../filename.php' );

    all these with a dot, is relative to the calling page

    this setting makes more sense:
    include_path = ".;C:\Inetpub\vhosts\massvacation.com\httpdocs\htdocs2007Launch_includes"
    ..when you need only use this in any script in your server tree:

    <?php
    // will find any file in: C:\Inetpub\vhosts\massvacation.com\httpdocs\htdocs2007Launch\_includes
    include( 'filename.php' );
    
    ?>

      Firstly, is the missing quote at the end of 'document_root' just a typo here, or actually missing in the code?

      Assuming it's just a typo, you might want to do a quick little test to see what PHP actually thinks the document root is:

      <?php
      echo "Document root is: " . $_SERVER['document_root'];
      ?>
      

        Nevermind, i fixed it, yes it was a typo and not in the code.

          Thanks for the response halojoy, i am aware of all that. Unfortunately the 400 page site was built using all document_root in all the pages.

          I had kind of a hacky fix, I auto appended a file through PHP.ini in which I explicitly set document root in the $_SERVER array.

          Whatever, it worked, and after next week, this site will not be my problem.

            I see.
            It was a very special case.
            🙂

              Write a Reply...