What is an .inc file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bladecatcher
Forum Commoner
Posts: 67
Joined: Sat Mar 12, 2005 12:50 am

What is an .inc file

Post by bladecatcher »

G'day Guys,

What is an .inc file?

Yep, I know it's interchangable with .php, I've tried it and I've googled a lot but why .inc and not .php?

any links *or* keywords to help me get my head around this appreciated.

tia
bladecatcher
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

An include file. Its not interchangable with .php .. .inc (usually) isn't parsed as PHP.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

At first I thought .inc is parsed by PHP. But I had my files like xxx.php.inc. Using IIS, if the extension is inc which is not a valid php file. But using Apache (Windows and Linux), somehow it parses as php. In fact, in Apache, any file having .php anywhere (not necessarily at end) will be parsed as php.
This is how its working on my PC and web host.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

Normally use can use .php for core code. If a php file contains "include <filename>;" these <filename>'s are frequently named *.inc to indicate that the file is included into one or more .php files. This is purely a user convention.

How they get processed if referenced via url is dependant upon your server settings.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

Some may use .inc.php - simply to ensure it is parsed correctly. .inc is simply a user preference - something to mark that a file is included into other PHP files, and not necessarily directly accessible (or accessible in any meaningful way) by a browser.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Maugrim_The_Reaper wrote:Some may use .inc.php - simply to ensure it is parsed correctly. .inc is simply a user preference - something to mark that a file is included into other PHP files, and not necessarily directly accessible (or accessible in any meaningful way) by a browser.
I just keep all my include files as .php but under an "includes" directory. As you say it's just a preference.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

be careful storing sensitive information inside a *.inc file as the raw data will be display in the browser if the user navigates directly to that file.

IMO, if you wanted to distinguish between include files using the filename...i would do...somescript.inc.php
Post Reply