php or html on html 5

Might be a dumb question: do I need .php (webfast) on html 5 pages?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

These are orthogonal concepts. PHP is a server-side programming language, which often generates HTML (4 or 5, or XHTML) as its output. The simplest sort of PHP instructions may be inserted inline within an otherwise “normal” HTML page, and when the PHP process finishes, all of the PHP instructions will be stripped out and replaced with the product of those instructions.

<!DOCTYPE html>
<html>
<head>
<title>Stupid Example</title>
</head>
<body>
	<h1>Hello, World!</h1>
	<p>The date today is 
		<?php echo date('Y-m-d', time()); ?>.
	</p>
</body>
</html>

Most servers that are configured to run PHP are also configured such that you must name your files with the file extension .php if you want them to run through the PHP process. This is because such a server may also run .html files side-by-side with the .php files, and in that case, the .html files are served “as-is”, not run through the processor at all, thus saving a few fractions of a percent of the server’s computational power.

It is less common, but still possible, to configure a Web server so that every file served is sent through the PHP process. This lets you serve .html files that contain PHP instructions without needing to name them in a particular way. This may have security implications, because it helps to disguise the origin of your content, and reduce the number of clues you give a potential hacker. The down-side is that every file, whether it needs it or not, must be scanned by the PHP processor for programming instructions, and this takes a tiny but measurable amount of time.

All this to say that HTML5 is no different than HTML or XHTML in the context of PHP. You use PHP if you need its particular abilities.

In the case of WebFast, if you have enormous, text-heavy pages, then you would want to either enable GZip on your server, or use the Action. Of the two, the server option will be faster, because the gzipped file will be cached by the server, and only re-generated if the original is updated. The PHP technique actually compresses the content of the page in memory, every time the page is requested, and this is more than a little wasteful. It only pays off if your page is mostly text, and large enough that the time to compress the page is less than the time it would take to transmit the uncompressed page to the visitor.

Either of these techniques will save you money on bandwidth, should you be in a hosting environment that only allows you a limited amount of data per month.

Walter

On Dec 3, 2013, at 4:25 AM, GTPeter wrote:

Might be a dumb question: do I need .php (webfast) on html 5 pages?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options