473,382 Members | 1,651 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

htm Extension

Can I configure Apache to recognize PHP Code in a page with an .htm
extension? If so, how do I do it?

Thanks.

Bruce
Jul 17 '05 #1
6 1635
Bruce A. Julseth wrote:
Can I configure Apache to recognize PHP Code in a page with an .htm
extension? If so, how do I do it?

Thanks.

Bruce


..htaccess file (in the directory where you want to enable it) should
contain the following:

AddType application/x-httpd-php .htm

No need to do it for the sub-directories, it's recursive.

--
Justin Koivisto - ju****@koivi.com
http://koivi.com
Jul 17 '05 #2
Be careful when you make a change like that. When you suddenly make
non-executable files executable, you could introduce very serious
vulnerabilities.

For example, say you have log analyser that produces .htm files. In the
reports, the names of the browsers are listed. If the analyser doesn't
properly escape the user-agent field, then an attacker can inject PHP
code into your site.

Jul 17 '05 #3
I agree with Chung, this is a rather non-standard and risky kind of
change to make. Be sure to review your alternatives before choosing
this action.

~D

Jul 17 '05 #4
Could you elaborate on that? How would a person be able to inject code
because
of an improperly escaped field?

And why would this be a risk with a PHP generated .htm file and not a
static .htm
file with similar escaped field?

Or for that matter, would a .php file be immune from this exploit?

Jul 17 '05 #5
> Could you elaborate on that? How would a person be able to inject code
because
of an improperly escaped field?

And why would this be a risk with a PHP generated .htm file and not a
static .htm
file with similar escaped field?

Or for that matter, would a .php file be immune from this exploit?


These vunrubilities do exist however it is a little different because
you are adding a scripting language to a filetype that is not ment to
have a scripted language and is not default behavior.

However, most clients should always make sure to escape a field but here
is the problem.

Someone sends there user agent as: <?php echo('hi); ?> (would most
likely be worse) and then all of a sudden for your useragent in a log
writer could show that. Now when that is parsed through php, obviously
you are going to get "hi".

Now when the useragent is used in php you can not execute anything
because you are either parsing the value from the database or just using
the $_SERVER variable to retrieve the string. Now I say string because
all PHP things of it is that it is a string.

I hope that helps and clarifies things a bit.

Mike
Jul 17 '05 #6

"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:42********@news1.prserv.net...
Can I configure Apache to recognize PHP Code in a page with an .htm
extension? If so, how do I do it?

Thanks.

Bruce


Thanks for the help.. I guess I'll remain using PHP as my extension.

Thanks again..
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Gyger | last post by:
Hello, Three weeks ago, I have started to develop a binding extension for Qt and PHP 5. Now, I can display a dialog box containing some widgets like label, buttons and edit line. I have just...
8
by: Torsten Mohr | last post by:
Hi, i write an extension module in C at the moment. This module does some work on some own data types that consist of some values. The functions that can change the data are written in C. ...
3
by: man-in-nature | last post by:
Hello, I have already read several existing posts about xsd:extension, but do not find something useful to my test case. I have one xml file and one xsd file. I can use a simple command line...
5
by: Jeffry van de Vuurst | last post by:
Hi, I'm working on an xml schema and I'm running into some problems relating substitutionGroups and extensions. This xsd validates fine: There are three elements and three complex types and...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
4
by: pepcag | last post by:
I used http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconalteringsoapmessageusingsoapextensions.asp as a template to create a very simple web method with soap...
1
by: Brian Henry | last post by:
Just thought maybe someone here would like to know this. It's an example code I just created quickly on how to figure out the name of a type of file based on its extension (say for example .DOC)...
0
by: robert | last post by:
Hi all, I'm having a hard time resolving a namespace issue in my wsdl. Here's an element that explains my question, with the full wsdl below: <definitions name="MaragatoService"...
6
by: tommybiegs | last post by:
I'm having a weird problem. I can't seem to force php to load an extension using php.ini, but it loads perfectly if I use dl() at the beginning of a test script. In php.ini I've got: ...
1
Ganesh9u
by: Ganesh9u | last post by:
Hi All, import org.sf.feeling.swt.win32.extension.hook.Hook; import org.sf.feeling.swt.win32.extension.hook.data.HookData; import org.sf.feeling.swt.win32.extension.hook.data.MouseHookData; ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.