Reply
Another newbie question - advantages of processing html with php engine?
Old 01-05-2009, 06:15 PM Another newbie question - advantages of processing html with php engine?
magicvw's Avatar
Extreme Talker

Posts: 197
Name: Vicky
Location: Brit in Bulgaria
Trades: 0
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?
__________________
My Music Theory

Blog
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
 
When You Register, These Ads Go Away!
Old 01-05-2009, 06:37 PM Re: Another newbie question - advantages of processing html with php engine?
jason_alan's Avatar
Super Talker

Posts: 101
Name: Jason
Location: Seattle, WA
Trades: 0
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.
jason_alan is offline
Reply With Quote
View Public Profile
 
Old 01-05-2009, 06:39 PM Re: Another newbie question - advantages of processing html with php engine?
Decaf's Avatar
Ultra Talker

Posts: 490
Name: Adam
Trades: 0
Google has to use something similar to this, otherwise how are they able to dynamicly display different text/images for google.com/index.html
__________________
Decaf is offline
Reply With Quote
View Public Profile Visit Decaf's homepage!
 
Old 01-05-2009, 06:48 PM Re: Another newbie question - advantages of processing html with php engine?
tripy's Avatar
Do not try this at home!

Posts: 3,141
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
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.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is online now
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-05-2009, 06:56 PM Re: Another newbie question - advantages of processing html with php engine?
magicvw's Avatar
Extreme Talker

Posts: 197
Name: Vicky
Location: Brit in Bulgaria
Trades: 0
Quote:
Originally Posted by tripy View Post

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
__________________
My Music Theory

Blog
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
Old 01-05-2009, 06:56 PM Re: Another newbie question - advantages of processing html with php engine?
wayfarer07's Avatar
NYE-KEE

Posts: 3,136
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
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.
__________________
Wayfarer | jQuery Tooltip Plugin
Freelance Jobs Available
If Google is the Coca-Cola of Web search, Bing is RC Cola
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 01-05-2009, 06:59 PM Re: Another newbie question - advantages of processing html with php engine?
jason_alan's Avatar
Super Talker

Posts: 101
Name: Jason
Location: Seattle, WA
Trades: 0
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
jason_alan is offline
Reply With Quote
View Public Profile
 
Old 01-05-2009, 07:01 PM Re: Another newbie question - advantages of processing html with php engine?
magicvw's Avatar
Extreme Talker

Posts: 197
Name: Vicky
Location: Brit in Bulgaria
Trades: 0
Quote:
Originally Posted by wayfarer07 View Post
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.
__________________
My Music Theory

Blog
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
Old 01-05-2009, 07:07 PM Re: Another newbie question - advantages of processing html with php engine?
magicvw's Avatar
Extreme Talker

Posts: 197
Name: Vicky
Location: Brit in Bulgaria
Trades: 0
Quote:
Originally Posted by jason_alan View Post
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!
__________________
My Music Theory

Blog
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
Old 01-05-2009, 07:52 PM Re: Another newbie question - advantages of processing html with php engine?
tripy's Avatar
Do not try this at home!

Posts: 3,141
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Originally Posted by magicvw View Post
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.
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 01-05-2009 at 07:56 PM..
tripy is online now
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 01-05-2009, 08:34 PM Re: Another newbie question - advantages of processing html with php engine?
chrishirst's Avatar
Super Moderator

Posts: 21,651
Location: Blackpool. UK
Trades: 0
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.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-05-2009, 08:39 PM Re: Another newbie question - advantages of processing html with php engine?
King Spam Talker

Posts: 1,398
Trades: 0
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.
__________________
Colbyt
colbyt is online now
Reply With Quote
View Public Profile
 
Old 01-06-2009, 08:27 AM Re: Another newbie question - advantages of processing html with php engine?
magicvw's Avatar
Extreme Talker

Posts: 197
Name: Vicky
Location: Brit in Bulgaria
Trades: 0
Quote:
Originally Posted by tripy View Post


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 View Post
As you said, we are here to help.
__________________
My Music Theory

Blog
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
Old 01-06-2009, 08:29 AM Re: Another newbie question - advantages of processing html with php engine?
magicvw's Avatar
Extreme Talker

Posts: 197
Name: Vicky
Location: Brit in Bulgaria
Trades: 0
Quote:
Originally Posted by colbyt View Post
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
__________________
My Music Theory

Blog
magicvw is offline
Reply With Quote
View Public Profile Visit magicvw's homepage!
 
Reply     « Reply to Another newbie question - advantages of processing html with php engine?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.18036 seconds with 13 queries