php class file extensions

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

php class file extensions

Post by Obadiah »

k...im trying to create a class file in php or a authentification script. what extension do i use? do i save it as a .inc or a .php
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: php class file extensions

Post by Chris Corbyn »

Obadiah wrote:k...im trying to create a class file in php or a authentification script. what extension do i use? do i save it as a .inc or a .php
Doesn't really make any difference but I'd suggest using .php since if the host is not set to parse .inc as PHP files the code will be displayed in a web browser for all to see.
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Post by Obadiah »

so whats the difference in .inc and .php files.....do i even have to use .inc, can i replace all such files with a .php extension?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

As d said, so long as the server parses the file as php it could be anything as far as extensions go. Yes, you can rename them to .php just fine. You just have to make sure all your code reflects such a change.
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

Re: php class file extensions

Post by Obadiah »

d11wtq wrote:Doesn't really make any difference but I'd suggest using .php since if the host is not set to parse .inc as PHP files the code will be displayed in a web browser for all to see.
ok....how does the file know to look at that file bc the file that im creating uses globals and arrays from another file....the book that i have says name them .inc my guess is because .inc stands for includes(the file is used as a resource or back up) so how would u tell the program your creating like a web form to parse a .php....ive been wondering that ever since i started even with the .inc bc the one that its asking to reference is a totally different file then its using for the rest of the information
Post Reply