SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Chicago
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question PHP include file protection

    My new host provider Yahoo said inc files will not be read by there PHP interpreter. However, they suggest I re-name my *.inc file to a *.php instead.
    "PHP file is protected automatically by our server" according to Yahoo.

    Am I safe. What should I do.

    Lastly does the server always look for include files in the root file (I do not have access to the php ini file). The reason I ask is I loaded phpbb2 (bulletin board) software to my server and I notice it has an include folder in the phpbb2 directory. How do the phpbb2 include file requests know to go to phpbb2/includes/xxx instead of www/mydomain/includes/xxx

    Thanks everyone

  2. #2
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They are correct. If you name it .inc, then anyone can go into your directory and download it -- ie. domain.com/mysql.inc will download, therefore if you have any sensitive data in it, they'll find it. Most people rename it to mysql.inc.php, so that they still have the "inc" identifier, but it's parsed as PHP (so if you define a few variables, it'll be a blank file if they access it directly).

    Include also looks in the current working directory by default.

  3. #3
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Chicago
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php inc

    I read Kevin Yanks chapter 10 on includes in his book "Database Driven Website" and I'm still a littled puzzled on the inc extension. What does the inc extension mean to the server ? When would someone want to use a .inc or .php in an include function ?

  4. #4
    SitePoint Zealot swiftone's Avatar
    Join Date
    Mar 2005
    Location
    Sunny Florida
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why use .inc at all?

    I am curious also, why use the '.inc' at all?
    Happy Coding,
    Swiftone

    Unique Web Sites

  5. #5
    SitePoint Addict SRTech's Avatar
    Join Date
    Mar 2005
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by swiftone
    I am curious also, why use the '.inc' at all?
    I don't think there really is any reason too.

    I think it was a trend to name files that were only included in other .php files (not accessed directly) *.inc. If you still want to label them as being files that are only included, name them file.inc.php or something.

    Just my opinion.

  6. #6
    SitePoint Evangelist djdykes's Avatar
    Join Date
    Feb 2005
    Location
    Chester, Cheshire
    Posts
    565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    to the server .inc is a text file, as is .class etc

    i think what yahoo are trying to say is don't name your files .inc yeah it's an easy way to remember which files are the includes but what someonewhois said is right. name it .php that way it will appear blank when requested. Otherwise the code will appear as plain text. try it out locally


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
  •