Closed Thread
Results 1 to 6 of 6

Thread: Configure Apache to allow php code IN html.

  1. #1
    Active Member WorldBuilder is on a distinguished road
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    366

    Configure Apache to allow php code IN html.

    Hi guys,

    I know a reasonable amount about Apache, but am no expert. Have a question for you. My Apache server is running on linux. All of my pages on my site are .html extensions (except for a few .php pages. Recently, I started learning php. One thing I tried was to put php code INTO html. When I did this and tried to view the site, the php code would actually show up ON the site in the browser. I have been told that:
    "PHP has to be in pages that end with the .php extension, unless your server is set up to run .html pages through the parser. Most shared hosting is set up to only process php scripting in .php, .php3 and .php4 pages."
    I'll look into it, but what exactly does that mean, and what do I have to do in httpd.conf to allow php code to run in html? Thanks!

    Chris
    My Site | My Blog
    "The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing."
    "Insanity is doing the same thing over and over again, expecting different results"
    --Albert Einstein

  2. #2
    Full Member mttatkns is on a distinguished road
    Join Date
    Jan 2004
    Location
    92677
    Posts
    26
    In your httpd.conf (assumming that you currently have php working), you should see a line such as "AddType application/x-httpd-php .php .phtml". Change this to "AddType application/x-httpd-php .php .phtml .html" and so on for other extentions you want to allow php in.

  3. #3
    Active Member WorldBuilder is on a distinguished road
    Join Date
    Jan 2004
    Location
    Boston, MA
    Posts
    366
    Hey Matt. Thanks! I actually found an answer at DS. Got it working today.

    Chris
    My Site | My Blog
    "The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing."
    "Insanity is doing the same thing over and over again, expecting different results"
    --Albert Einstein

  4. #4
    Full Member whiteknight is on a distinguished road
    Join Date
    Jan 2004
    Location
    Philadelphia
    Posts
    42
    I've already got my apache parsing .shtml files for SSI includes, will it also parse them for php automatically, or do i need to specify php includes also?

  5. #5
    Full Member mttatkns is on a distinguished road
    Join Date
    Jan 2004
    Location
    92677
    Posts
    26
    To be on the safe side, add .shtml to the list as shown above.

  6. #6
    Full Member Matrix28 is on a distinguished road
    Join Date
    Feb 2004
    Posts
    34
    Originally posted by whiteknight
    I've already got my apache parsing .shtml files for SSI includes, will it also parse them for php automatically, or do i need to specify php includes also?
    You will need to add the extension to the handler.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts