This is a discussion on PHP in html within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I am a newby to PHP and just getting to grips with it. So far so good although I was ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
usenet.plus.net wrote:
> I am a newby to PHP and just getting to grips with it. So far so good > although I was wondering whether it is possible to have a page name > index.htm use php instead of using index.php Yes, but you must have admin rights to your web server so you can tell the web server that it should treat .htm files as php content. How this is done depends on your server, but is covered in the Apache and PHP docs, and probably also IIS' (and other servers') docs. However, doing so may cause unwanted load on your server - you'll need to figure out if PHP-processing every .htm file on your web server will be a problem, given your traffic, page count, etc. IMO it's not a problem for small sites. -- ----- stephan beal Registered Linux User #71917 http://counter.li.org I speak for myself, not my employer. Contents may be hot. Slippery when wet. Reading disclaimers makes you go blind. Writing them is worse. You have been Warned. |
|
|||
|
On Wed, 16 Jul 2003 17:55:03 +0200, stephan beal
<stephan@wanderinghorse.net> wrote: <snip> >However, doing so may cause unwanted load on your server - you'll need to >figure out if PHP-processing every .htm file on your web server will be a >problem, given your traffic, page count, etc. IMO it's not a problem for >small sites. Please define 'small sites' very small, small, medium, large, very large, etc . My local stats for past 15 days Monthly Statistics for July 2003 to midnight 15 Jul 03 Total Hits 290772 Total Files 198982 Total Pages 28189 Total Visits 4655 Total KBytes 1103245 Total Unique Sites 2563 Total Unique URLs 1723 This does not count the internal hits/visits etc... |
|
|||
|
Interesting
All my html files on my website use .htm as extension. If I therefore set the server to read .html files as php, then it should not overburden my server as I could make a point of only saving files with php content with a .html extension. Am I on the right track here? Regards Terry "stephan beal" <stephan@wanderinghorse.net> wrote in message news:bf3sc0$4f5$1@ork.noris.net... > usenet.plus.net wrote: > > > I am a newby to PHP and just getting to grips with it. So far so good > > although I was wondering whether it is possible to have a page name > > index.htm use php instead of using index.php > > Yes, but you must have admin rights to your web server so you can tell the > web server that it should treat .htm files as php content. How this is done > depends on your server, but is covered in the Apache and PHP docs, and > probably also IIS' (and other servers') docs. > > However, doing so may cause unwanted load on your server - you'll need to > figure out if PHP-processing every .htm file on your web server will be a > problem, given your traffic, page count, etc. IMO it's not a problem for > small sites. > > -- > ----- stephan beal > Registered Linux User #71917 http://counter.li.org > I speak for myself, not my employer. Contents may > be hot. Slippery when wet. Reading disclaimers makes > you go blind. Writing them is worse. You have been Warned. > |
|
|||
|
In message <sKYRa.48632$9C6.2603918@wards.force9.net>, Terry
<Terry@Nospam.com> writes >Interesting > >All my html files on my website use .htm as extension. > >If I therefore set the server to read .html files as php, then it should not >overburden my server as I could make a point of only saving files with php >content with a .html extension. > >Am I on the right track here? > >Regards >Terry > I think it makes more sense to have .htm and .html files contain HTML, and no php, so the apache can serve them straight. Much less load. Use .php for .php files. If you need php in the index file, call it index.php and do not have an index.htm or index.html file. (Which will be served in preference). All other options are non-standard, need admin privileges to set up, and cause future confusion to maintenance people, and imho should be strongly discouraged. I would (do) use php on my include files, although others prefer .inc. The problem with .inc is that it is served as plain text if the name is typed into a browser, and this can reveal database access passwords etc. To avoid this, set up apache to process .inc with php. To my mind this is a valid reason for messing with the standard setup, but just avoiding index.php in not. Regards Ian >"stephan beal" <stephan@wanderinghorse.net> wrote in message >news:bf3sc0$4f5$1@ork.noris.net... >> usenet.plus.net wrote: >> >> > I am a newby to PHP and just getting to grips with it. So far so good >> > although I was wondering whether it is possible to have a page name >> > index.htm use php instead of using index.php -- Ian - posting to a Newsgroup. Please remove everything to reply. |
|
|||
|
Markus G. Klötzer wrote:
> Normally that makes sense, but the OP mentionened the lack of .html > files, so it should make no difference if the parsed file is called > .html or .php (.htm still not being parsed) It makes sense only until someone has to maintain it and is very confused why .htm and .html files are treated differently. We must remember that ..htm are only called .html for historical reasons: they are a hold-over from the DOS 8.3 filename days. Thus .htm and .html SHOULD mean the same thing. -- ----- stephan beal Registered Linux User #71917 http://counter.li.org I speak for myself, not my employer. Contents may be hot. Slippery when wet. Reading disclaimers makes you go blind. Writing them is worse. You have been Warned. |
|
|||
|
Terry wrote:
> Perhaps it would help if I mention why I want to use the .html instead of > .php and then you could advise > > My thoughts are that if a potential hacker views my webpage and recognises > the .php in the address bar of his browser, then immediately he will know > that I am using PHP and therefore be one or perhaps even two steps closer to > hacking into my site. He might then know that there would be .inc files on > my server that could reveal passwords or use other methods of hacking PHP > that I might not be aware of. Just don't use .inc-files for things like passes etc. Simple as that... you aren't forced to use inc's, you can use PHP as well. > If I use .html as the extension he might not recognise this and might > actually fumble around a little first to try and find out how my webpages > are coded. After initial attempts fail, the hacker might actually decide to > pry on other sites where this is more obvious and easy to figure out. Just for the record: you aren't talking about a hacker, but about a cracker. It's a big difference. Regards, Blizt |
|
|||
|
On Thu, 24 Jul 2003 09:01:17 +0100, "Terry" <Terry@Nospam.com> wrote:
>Perhaps it would help if I mention why I want to use the .html instead of >.php and then you could advise <Snip> Why not use the php files to generate static html every night - how often do your files need to be updated? I think the tool to auto run php files is called cron. |