Another newbie question - advantages of processing html with php engine?
01-05-2009, 05:15 PM
|
Another newbie question - advantages of processing html with php engine?
|
Posts: 184
Name: Vicky
Location: Brit in Bulgaria
|
I'm on chapter 2 of Beginning PHP and have just read this:
It is possible to configure your Web server to send files with other extensions (such as . htm and . html) to the PHP processing engine. If you make this configuration change, your ordinary HTML Web pages will be processed through the PHP engine (in addition to all your PHP-coded Web pages), although ordinary HTML files won't change as a result (and this adds a bit of overhead). Because the files sent to the users will end with . htm or . htmlphp, it won't be evident to them that PHP was being used for back-end processing. Whether to add these extensions is your choice, but it's recommended if you want to keep people from knowing that you're using PHP to process your Web application.
Well I can't configure my server because it's not my own, but out of curiosity I was wondering why people do this - why would you be bothered about people knowing that you're using PHP?
|
|
|
|
01-05-2009, 05:37 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 98
Name: Jason
Location: Seattle, WA
|
Another way I have used to do this is to use mod_rewrite to send *.html urls to actual php pages.
It doesn't matter though if people know you're using php if you have a secure application.  Otherwise, I guess it's a way to make a hacker guess at your server-side language, though there's other ways for them to find this out. For instance a 404 error page.
|
|
|
|
01-05-2009, 05:39 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 490
Name: Adam
|
Google has to use something similar to this, otherwise how are they able to dynamicly display different text/images for google.com/index.html
|
|
|
|
01-05-2009, 05:48 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 2,819
Name: Thierry
Location: Latitude 46.79057 :: Longitude 7.119377
|
Quote:
|
Google has to use something similar to this, otherwise how are they able to dynamicly display different text/images for google.com/index.html
|
Nope, they use a script that generate the page, and specify the mime type of thhe content.
You can have a .php that display a pdf, as a .php that displays a multipage tiff image.
It has nothing to do with url rewriting.
Vicky, do you mind explaining why you would hide the fact that you use PHP?
I have nothing pro nor against it, but I'm just curious of the motivation.
I never really cared myself, and I don't see why you would, but as a devlopper that worked on really busy sites (having several giga of transfer per days) I would advise against parsing .html files.
But of course, if your traffic is much lower than what I had to deal with, you probably won't even feel the overhead.
__________________
Trust me, I know what's good for you...
|
|
|
|
01-05-2009, 05:56 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 184
Name: Vicky
Location: Brit in Bulgaria
|
Quote:
Originally Posted by tripy
Vicky, do you mind explaining why you would hide the fact that you use PHP?
|
I have no opinion on the matter - if you re-read my original post, my question is exactly that - why do some people feel it's necessary? I am far too new to PHP to know the answer. I'm just intrigued that this paragraph appeared in only chapter 2 of my Beginners PHP book, with no further comment as to why it might be done - hence picking your experienced brains on here!
Personally if I ever manage to create something half useful with PHP I will be probably announcing it in The Times, not hiding it behind an HTML page 
|
|
|
|
01-05-2009, 05:56 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 2,630
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
I converted a relatively large static (though not high traffic) site to use PHP recently, and forced the server to parse .html as PHP since it would have been too much work to rename every page, as well as redirect each page to its new location (to avoid confusing search engines). So that is one use that I can think of.
Its true you don't always want to do this, because, as pointed out, if traffic is high the PHP engine should avoid loading up when a static HTML page doesn't need scripting.
|
|
|
|
01-05-2009, 05:59 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 98
Name: Jason
Location: Seattle, WA
|
Let's just say don't worry about it for now since you are on chapter 2, you have much more to learn first! Good luck though 
|
|
|
|
01-05-2009, 06:01 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 184
Name: Vicky
Location: Brit in Bulgaria
|
Quote:
Originally Posted by wayfarer07
I converted a relatively large static (though not high traffic) site to use PHP recently, and forced the server to parse .html as PHP since it would have been too much work to rename every page, as well as redirect each page to its new location (to avoid confusing search engines). So that is one use that I can think of.
Its true you don't always want to do this, because, as pointed out, if traffic is high the PHP engine should avoid loading up when a static HTML page doesn't need scripting.
|
Thanks!  That makes sense.
|
|
|
|
01-05-2009, 06:07 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 184
Name: Vicky
Location: Brit in Bulgaria
|
Quote:
Originally Posted by jason_alan
Let's just say don't worry about it for now since you are on chapter 2, you have much more to learn first! Good luck though 
|
Don't I know it!  And it doesn't help that there are typos in the book - I spent an hour today trying to figure out why a bit of script didn't work, and eventually discovered they'd missed off a dot.  The problem really is that when a subject is new, you don't know what you need to know and what you can ignore - but that's why you guys on here are so great! 
|
|
|
|
01-05-2009, 06:52 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 2,819
Name: Thierry
Location: Latitude 46.79057 :: Longitude 7.119377
|
Quote:
Originally Posted by magicvw
I have no opinion on the matter - if you re-read my original post, my question is exactly that - why do some people feel it's necessary? I am far too new to PHP to know the answer. I'm just intrigued that this paragraph appeared in only chapter 2 of my Beginners PHP book, with no further comment as to why it might be done - hence picking your experienced brains on here!
Personally if I ever manage to create something half useful with PHP I will be probably announcing it in The Times, not hiding it behind an HTML page 
|
I feel like you on that subject.
In my opinion, that paragraph is there because of those "black oil SEO" that consider that php is bad for pr.
Maybe the author got a lot of request as how you could hide the fact that php is running on the site, and added this...
The point is, there is no point (!!) in hidding it.
Do as you want, people won't get away of your site just because you have a .php at the end of the url.
If they do get away, the cause would be elsewhere.
Quote:
|
And it doesn't help that there are typos in the book
|
Have you looked at the editor web page?
Usually, when typos like those are found, you can download the corrected scripts from the web site directly.
The book is still wrong (but I usually mark them with a pencil) but you have the working examples.
Quote:
|
The problem really is that when a subject is new, you don't know what you need to know and what you can ignore
|
As they told me, "the more you know, the more you know how few things you know" (roughly translated from French...)
Good luck, and don't hesitate to ask.
As you said, we are here to help.
__________________
Trust me, I know what's good for you...
Last edited by tripy : 01-05-2009 at 06:56 PM.
|
|
|
|
01-05-2009, 07:34 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 19,022
Location: Blackpool. UK
|
The whole thing of server load on HTML parsed as PHP is somewhat overstated. You will increase the server processing time more by mixing php script with HTML in a .php page than having an all HTML page with no php script in it.
The php interpreter starts when Apache starts, but doesn't execute any code until a <?/<?php tag is detected and will stop when ?> is reached or when exit() or die() functions are executed.
|
|
|
|
01-05-2009, 07:39 PM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 1,362
|
Magicvw,
The yes you can parse html pages as php on most servers has already been answered.
The only semi-valid reasons that I can think of is that:
it looks more friendly for those few who notice it,
is does not give awy the fact that you are using php which might slow down some wanna be hackers.
I use the html extension for the displayed pages and stick with the php extension for the included pages.
The process of parsing html is one simple line in the .htaccess file.
|
|
|
|
01-06-2009, 07:27 AM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 184
Name: Vicky
Location: Brit in Bulgaria
|
Quote:
Originally Posted by tripy
Have you looked at the editor web page?
Usually, when typos like those are found, you can download the corrected scripts from the web site directly.
The book is still wrong (but I usually mark them with a pencil) but you have the working examples.
|
Good shout - I will take a look - thanks!
Quote:
Originally Posted by tripy
As you said, we are here to help.
|

|
|
|
|
01-06-2009, 07:29 AM
|
Re: Another newbie question - advantages of processing html with php engine?
|
Posts: 184
Name: Vicky
Location: Brit in Bulgaria
|
Quote:
Originally Posted by colbyt
Magicvw,
The yes you can parse html pages as php on most servers has already been answered.
The only semi-valid reasons that I can think of is that:
it looks more friendly for those few who notice it,
is does not give awy the fact that you are using php which might slow down some wanna be hackers.
I use the html extension for the displayed pages and stick with the php extension for the included pages.
The process of parsing html is one simple line in the .htaccess file.
|
Thanks
So it's not only me who thinks html looks more friendly than php then!
Thanks also to Chris for the input 
|
|
|
|
|
« Reply to Another newbie question - advantages of processing html with php engine?
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|