SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Includes

  1. #1
    SitePoint Addict
    Join Date
    Mar 2010
    Location
    UK
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Includes

    I just read a comment in another thread which stated that server-side includes should be stored in a directory that is outside of the public part of the directory structure. I didn't want to jump in on someone else's thread and a search found nothing, so I have a few questions about that.

    What benefits does it bring? Surely what amounts to HTML snippets are not of any interest or at any risk?

    If it is worthwhile, how would I do it? How do I work out if the directory structure is suitable and whether the host will allow it? How do I write the includes to access such a directory?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    14,431
    Mentioned
    74 Post(s)
    Tagged
    1 Thread(s)
    I think it was mentioned in the other thread, but it doesn''t mean every file you "include" eg. header.tpl.php and footer.tpl.php should be OK wherever.

    But if the PHP pasrser crashes and a .php file is requested, it will be served as plain text.

    So things like passwords.php, databaseloginfo.php etc. are best kept outside of the public root.

    You can also put media or other files outside the root and have a public file fetch them when and if certain text conditions are met.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •