Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8570387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:32:48+00:00 2026-06-11T18:32:48+00:00

I’ve set up a virtual host for my local machine. This is what I

  • 0

I’ve set up a virtual host for my local machine.

This is what I have in my /etc/hosts file:

127.0.0.1   localhost local.dev
127.0.1.1   tomica-ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

This is configuration for that virtual host in my /opt/lampp/etc/extra/httpd-vhosts.conf:

<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs/dev"
    ServerName local.dev
</VirtualHost>

In my /opt/lampp/htdocs/dev/index.html I have this:

<html>
<body>
    <p>HTML</p>
    <?php echo 'PHP' ?>
</body>
</html>

But when I open http://local.dev in my browser, I only see:

HTML

However, if I open the document source, I can see:

<html>
<body>
    <p>HTML</p>
    <?php echo 'PHP' ?>
</body>
</html>

And if I inspect the page’s DOM, there’s:

<html>
<body>
    <p>HTML</p>
    <!--<?php echo 'PHP' ?>-->
</body>
</html>

Also, if I rename /opt/lampp/htdocs/dev/index.html to /opt/lampp/htdocs/dev/index.php everything seems to be alright.

Why is my PHP code not parsing in the .html document?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:32:49+00:00Added an answer on June 11, 2026 at 6:32 pm

    By default mod_php does not tell Apache to let it handle documents with the .html extension. If you change the handler type using the AddHandler directive:

    AddHandler php-script .html
    

    then Apache will know that you want to let PHP process the contents of files with a html extension.

    The reason this is not enabled by default is because running a document through the PHP interpreter costs (in CPU, in memory usage, in end-user time). There is no point in wasting time – so in mod_php’s default setup HTML files (which normally are static affairs) are not passed through the PHP interpreter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I have a reasonable size flat file database of text documents mostly saved in
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.