BooBoo
07-16-2002, 06:20 PM
I have installed the php package and I can create php pages and get them to work. However, I cannot get php code inside of html pages to work or parse. I think that the problem is in httpd.conf, however, I could be wrong.
I can run a php page to display the version. Also, I can run phpMyAdmin. When I add php code to the html page, nothing happens. According to documentation that I located, I needed to add a LoadModule line and an AddModule line. Then I needed to modify the AddType line to include .html.
I did these steps, restarted httpd, stoped/started httpd, and nothing happens. Any ideas as to what I need to do or undo?
ffeingol
07-16-2002, 06:25 PM
What do you mean by a php vs html page? Apache uses the extension to figure out what to do with the page. So normally .php is processed as PHP and .html* not.
Frank
BooBoo
07-16-2002, 06:39 PM
But as I understand it, you can modify the AddType line for a virtual site and add the .html extension so that php will parse the html pages.
ffeingol
07-16-2002, 06:48 PM
Yes, that is true, but they would still have to be coded as PHP.
Frank
BooBoo
07-16-2002, 06:50 PM
I added the following code to a html page:
<?php
echo "Hello"
?>
and nothing happens. When this code is embedded in a php page, then it works.
ffeingol
07-16-2002, 07:00 PM
Yes, that looks correct.
What is the AddType for .php and what is it for .html? You stopped/stared Apache after making the change?
Frank
BooBoo
07-16-2002, 07:03 PM
I used one line for the AddType:
AddType application/x-httpd-php .php4 .php .html
I also added AddType application/x-httpd-php .html to the srm.conf file.
I stopped/started Apache after making the changes.
ffeingol
07-16-2002, 07:09 PM
Originally posted by BooBoo
I added the following code to a html page:
<?php
echo "Hello"
?>
and nothing happens. When this code is embedded in a php page, then it works.
I missed a typo. It should be:
<?php
echo "hello";
?>
Missing the ";" after "hello"
Frank
CmptrWz
07-16-2002, 08:05 PM
I thought AddType only accepted one extension(such as .html) per line
BooBoo
07-17-2002, 09:14 AM
The documentation that I read explictly stated to add to the same line. The document was found at :
http://hotwired.lycos.com/webmonkey/00/44/index4a_page4.html?tw=programming