Broadband
Dial-Up
Email
Hosting
Wireless
Security
Useful Tools
Quick Reference
Contact Us
Customer Portal
Site Search

Zen Internet Support Forum

Welcome to the Zen Internet community support forums.

Before posting we recommend you search our
extensive Knowledge Base or the forum archives
as an answer to your query may already be available.

Welcome to Zen Internet Support Forum Sign in | Join | Help
in
Forums Forum Rules

Where am I going wrong? Trying to use Server Side Includes - getting nowhere

Last post 25-05-2008, 11:38 AM by Redrum. 9 replies.
Sort Posts: Previous Next
  •  28-02-2008, 7:58 AM 29873

    Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    Hello,

    I have been editing a basic HTML site for some time now and am now trying to add some PHP.

    In my HTML page I have a line similar to this one:

    <!--#include virtual="/myfile.php" -->

    Thinking that when the interpreter gets to this line, it will invoke the PHP code contained in myfile.php which is sitting on the server.

    However, I don't think that this is happening. My PHP script isn't mine - it is one which I have downloaded from a website. (Want to make sure I know the mechanisms for getting a correct script to work before I go into programming myself). Do I have to set up any directives to enable the ZEN servers to parse my HTML files? I have played about with the .htaccess file but draws a blank.

    I have also tried creating a file carrying the "Hello World" PHP script found on this forum with the same result.

    Any help on how to get started will be very gratefully received.

    Thank you,

    Alan

  •  28-02-2008, 9:22 AM 29874 in reply to 29873

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    I'm no expert on this but it appears you're using an ASP include command to load a PHP script, you should try a PHP include command like the one documented on this article:


    http://www.w3schools.com/php/php_includes.asp 


    David Nelson
    Team Leader
    Business Support Unit
    Zen Internet
  •  28-02-2008, 1:15 PM 29878 in reply to 29874

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    David,

    Thank you for your quick reply but I am afraid that this makes little difference. I think that the code which I have used in the HTML page is correct - Dreamweaver puts a little "PHP" marker in the preview page and I have seen this include line elsewhere.

    I think that I need to direct the server to parse the included file but am unsure of how this is achieved. I have read that it could be to do with the .htaccess file but don't know what lines to add - the ones I have tried don't seem to work!

     Alan

  •  28-02-2008, 3:10 PM 29883 in reply to 29878

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    Where are you hosting the html file? On some servers, Zen's free web hosting server for example, have SSI disabled so this would have this effect.

    David Nelson
    Team Leader
    Business Support Unit
    Zen Internet
  •  28-02-2008, 9:18 PM 29890 in reply to 29883

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    Bronze service - not free.

    I have CPANEL access. Reading which I have done suggests that I can amend the APACHE settings but not a clue how to do this from my CPANEL screen!

     Alan

  •  29-02-2008, 9:56 AM 29891 in reply to 29890

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    Hi,

     Are you putting this include in a .html file or a .shtml file?

    By default SSI will only work in a .shtml file on cPanel - rename the file to test if this works.

    You can make Apache do SSI on .html files - to do this you will have to put 2 lines in your .htacess file...

    AddType text/html .html
    AddHandler server-parsed .html

     Hope this helps


    ---
    Paul Stead
    Technical Support
  •  03-03-2008, 5:15 PM 29956 in reply to 29891

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    Thank Paul,

    I am trying very hard - honest but not making progress.

    First of all the SHTML tip - I get an error similar to this one

    URL file-access is disabled in the server configuration in /data01/myZenUsername/public_html/MyDirectoryi/myfile.php on line 2

    Does this make sense and point to a config setting which I am missing?

    I am trying to add an RSS feed to my site which does not rely on JScript. The URL which I have been getting the code from is here: http://rssfeedreader.com

     As for .htaccess - tried a few settings with this file but started to get confused as I seemed to have multiple .htaccess files floating around my various folders. This may be because I have taken over as Webmeister for my club and these files were left by the previous incumbent -  I have left his files where they were and have been putting my files in a "NEW" folder - linking to these from the root folder where my INDEX.HTM file is placed.

     

    Alan

  •  11-03-2008, 9:46 AM 30039 in reply to 29956

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    Hi Alan,

    Sorry for taking a while to get back to you.

    It sounds like you're trying to include a file that's not on your server. This being the case you should really use cURL rather than an include - some security issues can come with includes. Info on cURL can be found here: http://uk.php.net/curl

    .htaccess applies to the folder it is in and every folder below it. So a .htaccess file in public_html will apply to public_html and every sub dir below it, unless you put a .htaccess in that sub dir which overwrites the settings in the original .htaccess.

    If in doubt, clear em out! and start your structure again. Having a good file structure will help later on when you come back to edit the site - speaking from experience!
     


    ---
    Paul Stead
    Technical Support
  •  11-03-2008, 7:32 PM 30051 in reply to 30039

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    Thanks for the idea and link Paul - will have a read and a play.

    I last did C programming some 10 years or so ago and things are gradually coming back to me - just want to get up to speed with the way t'internet has developed as the last time I was seriously into Website programming 'n' stuff, Java and Javascript was just a baby.

    Thanks again, no doubt ...."I'll be back!"

     Alan

  •  25-05-2008, 11:38 AM 30603 in reply to 29873

    Re: Where am I going wrong? Trying to use Server Side Includes - getting nowhere

    I don't get this thread.  Surely if you are trying to include php and have it parsed, you just need to change the file extension of the file you are including it into to a .php, then do a php include like so:

     

    <?php

    include 'myincludedfile.php';

    ?>

     

    Simple!
     

View as RSS news feed in XML