PHP #include guidance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sylvus
    Member
    • Apr 2003
    • 96

    PHP #include guidance

    I'm posting in an attempt to get my old vBulletin 2.3.0 board back up and running on a local PC.

    - The version of my OS is Windows XP SP3.

    - The version of IIS is 5.1.

    - The version of PHP is the CGI version - 4.30.52 (since vBulletin 2.3.0 is not compatible with PHP 5.3+).

    - The version of MySQL is 3.23.52.

    - The version of PhpMyAdmin is 2.5.7.

    Now the reason for all the older versions is this is exactly what I had running when I took the website down and things worked well.

    I was able to reinstall my copy of vBulletin 2.3.0 and set up the required database, then imported the back up SQL file of the original forum. Loading of the forum works, and it is fully functional when browsing to http:\\192.168.2.10\testsite\forum\index.php from the date of the backup made some 8 years ago.

    While attempting to get it up and running on my local system, the URL and directory structures have changed, resulting in blank pages loading through SSI includes or simply spitting out the PHP code itself where it's been called, thus the reason for this post.

    When I go into the directory and type the URL directly through the browser, the PHP page loads, so I'm thinking I've become confused with <!--#include virtual"/testsite/location/file.php" --> calls, which is why it works directly but not with SSI calls, or I've installed something incorrectly.

    Some information on the installation directory for vBulletin 2.3.0, as well as the header.php file and how I call it from an index.shtml file.

    This is where I have the testsite installed:

    G:\Inetpub\wwwroot\testsite

    This is where I have the vBulletin files installed:

    G:\Inetpub\wwwroot\testsite\form
    G:\Inetpub\wwwroot\testsite\form\admin


    This is the URL path I set in vBulletin's Control Panel under "General Settings":

    http://192.168.2.10/testsite/forum


    This is the URL of homepage set in vBulletin's Control Panel under "General Settings":

    http://192.168.2.10/testsite/forum/index.php


    This is the header.php I am attempting to call via "include virtual":


    (header.php - LOCATION: G:\Inetpub\wwwroot\testsite\forum)
    * I added the code from vBulletin's test PHP file for debug purposes.

    Code:
    <?php
    /////////////// CONFIG ///////////////
    //
    $path = "/Inetpub/wwwroot/testsite/forum/admin"; // set the path to your admin directory.
    //
    ///////////// END CONFIG /////////////
    
    require('./global.php');
    require("$path/config.php");
    
    echo($header);
    ?>
    
    <html>
    <head><title>vBulletin PHP Tester</title></head>
    <body>
    <!--
    <?php
    
    // determine if php is running
    if (1==0) {
      echo "-->PHP is not installed correctly - Please contact your system administrator.<!--";
    } else {
      echo "--".">";
    }
    
    echo "PHP is installed correctly";
    
    echo "<"."!--";
    
    ?>
    
    </body>
    </html>

    This is how I am calling header.php via an index.shtml file:


    (index.shtml - LOCATION: G:\Inetpub\wwwroot\testsite)

    Code:
    <!--#include virtual="/testsite/forum/header.php" -->

    With the above information, these are the results I am getting:



    Loading header.php directly through a web browser:
    - http://192.168.2.10/testsite/forum/header.php

    RESULTS: The header is displayed and the echo of "PHP is installed correctly" shown at the bottom.

    Loading index.shtml that calls header.php through a web browser:
    - http://192.168.2.10/Skullport/index.shtml

    RESULTS: No header is displayed and the echo of "PHP is not installed correctly - Please contact your system administrator" shown at the bottom.


    When I check IIS, right click on testsite -> Properties -> Home Directory TAB -> Configuration button -> Mappings:

    It lists the following extensions and executable paths -

    .shtml G:\Windows\system32\inetsrv\ssinc.dll
    .php G:\PHP\php.exe

    I've been trouble shooting this for the day and simply cannot get anything PHP related to spit out when calling it via an #include virtual or #include file.

    On a similar note, #include virtual works just fine with a regular .txt file from the same index.shtml file.

    Examples:

    <!--#include virtual="/testsite/menus/home_news.shtml" -->

    So I'm stumped as to what direction I need, or perhaps it is the path settings?

    Thought I'd give a shot here. Thanks!
    Last edited by Sylvus; Tue 14 Aug '12, 4:46pm.
  • Zachery
    Former vBulletin Support
    • Jul 2002
    • 59097

    #2
    You can't use SSI's inside of vBulletin.

    Comment

    • Sylvus
      Member
      • Apr 2003
      • 96

      #3
      I'm not trying to use SSI's inside of vBulletin.

      I'm trying to get an SSI include in index.shtml from the "root" directory of testsite, to call in a .php file using the #include virtual command.

      Loading header.php directly through a web browser:
      - http://192.168.2.10/testsite/forum/header.php

      RESULTS: The header is displayed and the echo of "PHP is installed correctly" shown at the bottom.

      Loading index.shtml that calls header.php through a web browser:
      - http://192.168.2.10/testsite/index.shtml
      <!--#include virtual="/testsite/forum/header.php" -->

      RESULTS: No header is displayed and the echo of "PHP is not installed correctly - Please contact your system administrator" shown at the bottom.

      I'm asking as to why that is? Is it the paths I have setup that are incorrect, my PHP installation or perhaps the IIS installation?

      Certainly, if loading a .php page from the directory in which the file exists in works, I'd expect calling it using the #include virtual command would as well.

      It does not and I don't know why.

      Comment

      • Zachery
        Former vBulletin Support
        • Jul 2002
        • 59097

        #4
        Why not just make ita php file and include it?

        Comment

        • Sylvus
          Member
          • Apr 2003
          • 96

          #5
          Sure, let's go that route then.

          So in an attempt to include a PHP file via the index.php page, I have the following:

          <?php include("forum/header.php");?>

          The header.php has the same information as I originally posted in the first message.

          <?php
          /////////////// CONFIG ///////////////
          //
          $path = "/Inetpub/wwwroot/testsite/forum/admin"; // set the path to your admin directory.
          //
          ///////////// END CONFIG /////////////
          require('./global.php');
          require("$path/config.php");
          echo($header);
          ?>
          Like the index.shtml file include reference, it also doesn't load anything, dumping out:

          Warning: main(./global.php) [function.main]: failed to create stream: No such file or directory in g:\Inetpub\wwwroot\testsite\forum\header.php on line 7

          Fatal error: main() [function.main]: Failed opening required './global.php' (include_path='.;g:\php\includes') in g:\Inetpub\wwwroot\testsite\forum\header.php on line 7

          So I'm stumped as to what direction I need, or perhaps it is the path settings?

          Now, I can get it to work by modifying all of the vbulletin files and changing

          require('./global.php');

          to

          require('global.php');

          but why would I want to modify all of the original vbulletin files just to get it working?

          That's why I've asked if it's a path issue in my original post in which I simply am unable to understand.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...