Proper include file extension?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruce W...1

    Proper include file extension?

    For include files I see both the file extensions .php and .inc used.
    Which one is proper? Does it matter? What's the diff?

    Thanks for your help.
  • Senator Jay Billington Bulworth

    #2
    Re: Proper include file extension?

    In article <3F6F2D9A.4F578 235@noDirectEma il.com>,
    "Bruce W...1" <bruce@noDirect Email.com> wrote:
    [color=blue]
    > For include files I see both the file extensions .php and .inc used.
    > Which one is proper? Does it matter? What's the diff?[/color]

    It doesn't matter, and neither one is really proper; you could include
    ..xyz files if you like.

    However, you should be aware that there's a potential security issue in
    using .inc (or anything other than .php, for that matter). If your
    webserver is not setup to parse .inc files as PHP, and someone requests
    the .inc file from your server, it's quite likely they'll receive just
    what they ask for. Including any passwords or other juicy bits in the
    ..inc file.

    I typically place variables into a file named config.php, and
    require_once() that file, for this reason.

    hth

    --
    Bulworth : funha@fung.arg | My email address is ROT13 encoded, decode to mail
    --------------------------|--------------------------------------------------
    <http://www.phplabs.com/> | PHP scripts and thousands of webmaster resources!

    Comment

    • bugs

      #3
      Re: Proper include file extension?

      Bruce W...1 <bruce@nodirect email.com> wrote:[color=blue]
      > For include files I see both the file extensions .php and .inc used.
      > Which one is proper? Does it matter? What's the diff?[/color]

      actually there is no differnce... the only thing is that it just
      makes it easier to recognise which files are used to be executed
      stand alone.. and which ones are used to be included and then exec.

      Comment

      Working...