Apache and SSI

Discussion in 'Apache' started by grutland, May 12, 2009.

  1. #1
    Hi,

    Trying to set up server side includes so I can use the following...

    <!-- #INCLUDE virtual="/test/test.php" -->
    HTML:
    And as far as Apache is concerned it says I have "mod_include" installed.
    However, it doesn't seem to do the above as an include, prints it out in the source as a comment.

    Any one ideas what I'm doing wrong/missing?

    Regards
     
    grutland, May 12, 2009 IP
  2. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #2
    Nope, no errors.
    I am also adding this line in my htaccess file...

    Options +Includes
    HTML:
     
    grutland, May 12, 2009 IP
  3. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    Has any one got any ideas?

    I'll add a little detail as to why I am trying to do this.
    I have just built my first server using Ubuntu and have Apache, PHP, and MySQL installed, and now have two sites running of it...

    http://www.lynxdevelopment.co.uk (which is mine)
    http://www.rutlandtiling.co.uk (client site)

    I plan to have quite a few more sites running in the future.
    I use VirtualHosts to create each site and have no issues with this at all.
    What I want to be able to do is have "shared" code, eg. global functions (parse strings, ints, etc) so that I don't have dupilcates of each and every function and possibly different versions where I've upgraded on some sites and forgotten on others.

    I created an Alias called "shared" and can do the following...

    http://www.lynxdevelopment.co.uk/shared/test.php
    http://www.rutlandtiling.co.uk/shared/test.php

    I was hoping I would also be able to do the following...

    
    // Instead of using...
    include '/var/www/shared/test.php';
    
    // I could use...
    include '/shared/test.php';
    
    // This didn't work but have found the following...
    virtual '/shared/test.php';
    
    PHP:
    Does this "virtual" work in the same way as "include"?
    Or is it just going to be easier to use the "include" function and call the script from it's absolute location?
    It looks like using SSI is quite difficult as I would have to parse .shtml files as php.
     
    grutland, May 13, 2009 IP
  4. grutland

    grutland Active Member

    Messages:
    86
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #4
    OK, never mind.
    Ignore this now, I've been reading up more into it.
    The "virtual" command in PHP acts the same as the apache include virtual command.

    I'm just going to live with it and use "include", I'll figure out a way of making it easier for me.
     
    grutland, May 13, 2009 IP