Solved

Parse PHP from within HTML?

Posted on 2006-06-12
4
269 Views
Last Modified: 2010-07-27
Hi experts. I have some html pages that I would like to include a small php snipet that sets a cookie for session id. Everything works fine if I set the file extension to php and use an <include> for the html.
However, I really would prefer to have .html extensions for these pages and not .php.
Is there a way to tell Apache to parse php code within an html page?
I am running Apache 2.0.54 setup on a W2K machine with apache 4.3.11
0
Comment
Question by:formadmirer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:sleep_furiously
ID: 16890349
Yes, you can add a directive (or modify an existing directive) like:

AddType application/x-httpd-php .php .htm .html

However, be aware that all html pages will be scanned by PHP interpreter, so there could be some performance cost to doing this.
0
 

Author Comment

by:formadmirer
ID: 16890984
Hi and thanks for the reply. I did already try that and everytime I would load the html page my browser would open a box to download the page.
I have tried so many things, including naming the files with shtml so I could use <includes>. Supposedly using this method requires no modification to the server's config file, however it didn't work for me.

I have tried both
AddType application/x-httpd-php .htm .html
and
Addhandler application/x-httpd-php .html .php
but with no luck on either one.
I just can't believe how much trouble I am having getting this to work. Usually I have no trouble at all setting up things on a webserver, but this one is really getting to me.
0
 
LVL 10

Accepted Solution

by:
sleep_furiously earned 250 total points
ID: 16895502
Are you running PHP as CGI or as a module?
0
 

Author Comment

by:formadmirer
ID: 16927788
Hadn't thought about that. I believe on this machine it is running under CGI. Will that make a difference in this situation?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question