This page explains it (and setup): http://ahtim.com/audio-sou
Note:Audio will be a bit lagging when open huge application such as iTunes.
Main Topics
Browse All TopicsHello All,
I have set up LAMP on my notebook. The versions of the packages are as follows
-Ubuntu 8.04
-Apache2
-MySQL, Server version: 5.0.51a-3ubuntu5.4 (Ubuntu)
-PHP-5
With this set up I am unable to run html files with php code embedded in it. The example html file (example.html) looks like this
<head>
<title>Greeting Program in PHP</title>
</head>
<body bgcolor=white>
Programming courses always start with a program that says<BR>
<font color=red size=5>
<?php
print ("Hello World.") ;
?>
</font><P>
On this course, the message is embedded in a web page.<HR>
Demonstration page for PHP training - Well House Consultants Ltd
<a href=http://www.wellho.net
</body>
To be precise, only the "Hello World" does not get displayed on the browser. Based on fix provided by some forums, I did the following
1. I added the .html extension to the /etc/apache2/mods-availabl
<IfModule mod_php5.c>
AddType application/x-httpd-php .html .php .phtml .php3
AddType application/x-httpd-php-so
</IfModule>
2. I created a file called .htaccess under /var/www/ directory and put
AddType application/x-httpd-php .html .php
line to that.
Both these fixes which worked for some people didn't worked for me. I am not sure what's going wrong here? Can anyone please let me know the fix?
Thanks,
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This page explains it (and setup): http://ahtim.com/audio-sou
Note:Audio will be a bit lagging when open huge application such as iTunes.
christophermccann, thanks for your response, Sorry for the delay.
>Does nothing get rendered out or does it render out the <?php tags as well?
Only html contents are rendered, no php contents are rendered, not even <?php tags.
>Did you restart apache after you made the update?
Yes, I did that every time I made changes to the apache2 sever files.
>Your extension on the file should not be .html but .php
This is what I don't want. Well if you can give me some nice one column php web templates then I will just use a php file. However, I want HTML and CSS for the style and design of the website. If that purpose can be served alone by php files then I can go for that.
Thanks,
Kailash
PHP is exactly the same as an html file except you can run php inside it as well as html css. Change your extension to .php and it should hopefully sort your problem. You will not need to change anything inside the file such as html or css. They are kept exactly the same as if the extension was .html
The file definitely needs to be .php to execute php code. If it asking to save the file it would suggest that Apache isn't running or you are trying to access the file locally not off the virtual server. You have probably looked into this but just in case, for it to execute the code you need to access the file from the server not a local file. I don't have experience with LAMP however I do use WAMP, you need to access the file using the ip address of the computer which will reference the root directory of the "server". If you haven't already tried that give it a go.
AddType application/x-httpd-php .html .php
the above line should be used for win, ie. wamp, and for *nix, try this line instead
AddType x-mapp-php5 .html .htm
and you should have no problem to embed php in html and the files still save with html extension as seen in my sites here
http://guides.jlbn.net/
points already assigned so just add my 2-cent thought here in case some other users might take a look at this solution ;)
I'm NOT completely agree w/ Craybe that "The file definitely needs to be .php to execute php code." and that's why I've provided the solution above as they are actually codes that I've been using for my pc's
to be exact, in my win7, I have this line:
AddType application/x-httpd-php .html .htm
and in my ubuntu, I have this line:
AddType x-mapp-php5 .html .htm
and most files, if not all, save as .html even they contain php script as seen on my sites here ;)
http://jlbn.net/
You are correct yfastud, but just because it is possible doesn't mean it is a good choice. The above code is conditional on operating system which means it is not a universal solution. This being the case there is a chance that an update to an OS or Browser may be released which will instantly invalidate your code. It is always best to keep things as simple as possible, if the file contains php call it a php file.
I'm not saying you're wrong though and I have definitely appreciate learning something new.
I agree with yfastud, that the flle extension need not be .php and I also agree with Craybe that if the file contains php then extension should be .php but it depends. I would say that if php is embedded in HTML then file extension should be .html and if the html is embedded in php code then the file extension should be .php. Let me know if I am wrong
It is all a matter of personal taste :-)
There is a short article at http://www.wellho.net/mout
It makes a good point of the fact that when some people see .php they will see it as a dynamic page and they won't bookmark it as it may change. They also think it may effect search engine hits, I know this is untrue as all my php websites use .php and they all show up fine in search engines. But public perception is a good point so using html is not necessarily a bad idea. Either way good luck with your project!
Business Accounts
Answer for Membership
by: christophermccannPosted on 2009-10-05 at 14:36:11ID: 25500031
Does nothing get rendered out or does it render out the <?php tags as well?
Did you restart apache after you made the update?
Your extension on the file should not be .html but .php