/    Sign up×
Community /Pin to ProfileBookmark

.php vs .html

does anyone have any insight into the use of extensions when working with PHP? I am building a site that will have PHP on every page, do I need to use the .php for every file? What is the rule?

thanks,
Andy

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@chazzyDec 14.2006 — you can setup your web server to parse any type of file with any type of application. by default, most web servers parse anything with a php extension as php, and let anything with an html extension get parsed by the client only.
Copy linkTweet thisAlerts:
@aprice42authorDec 14.2006 — I don't have control over the web server, so I won't be able to go that route.

anything with an html extension get parsed by the client only[/QUOTE]


who do you mean by client?
Copy linkTweet thisAlerts:
@bvg123Dec 15.2006 — Since you don't have control over the web server, you will most likely have to use .php extension. To test whether you can use .html, put a simple php script into an html file, upload it to the server, and view the page in your browser. If the page displays the raw php code, then you can't use .html. Hope that helps.
Copy linkTweet thisAlerts:
@NogDogDec 15.2006 — If you are on an Apache server, you can use a .htaccess file in your root web directory (or in its sub-directories if you want different behaviors in different directories) to specify which file name suffixes get processed as PHP. You would use a command like the following in the .htaccess file to tell Apache to process .htm and .html files as PHP files:
<i>
</i>AddType application/x-httpd-php .html .htm
Copy linkTweet thisAlerts:
@aprice42authorDec 15.2006 — what is the best way to edit the .htaccess file? Can I edit it through terminal in os x? if so how?
Copy linkTweet thisAlerts:
@NogDogDec 15.2006 — It's just a plain text file, so whatever you would edit such files with in OSX (I'm not familiar with that OS, so don't know the specific tool names).
Copy linkTweet thisAlerts:
@aprice42authorDec 15.2006 — Thank you all for your input....

: ) Andy
×

Success!

Help @aprice42 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...