Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Configuration

Status
Not open for further replies.

duckytn

Programmer
Dec 8, 2002
5
US
If memory serves me you can configure php.. through the php.ini ( I hope ) to parse html pages as php..can anyone confirm this one for me.. and if so what do I need to add to the ini file to make this happen.

Cheers!

ducky
 
Let me clarify abit.. I am converting an old html site to php. I am concerned about folks who have bookmarked and them getting the dreaded "File Not Found" error. One option I tried was a symbolic link index.html --> index.php. It appears when you go to the index.html page it will load the php page but it won't parse it. I also tried a meta refresh with a link to the new page and that leaves me with two index files to deal with.. index.php and index.html. When you go to the domain via it will load the index.html by default and give you the redirect every time. Any suggestions ?
 
<html>
<head>
<script>
location.href = 'index.php';
</script>
</head>
</html>

should do it! --BB
 
You can, also, UNCONVENTIONALLY, use the Apache httpd.conf (if you're using Apache) to declare that .html is to be processed as PHP script. Not really a great idea (if you get hit by a beer truck, someone might get confused), you might be able to get away with it.

You'd assign .html, .htm to the PHP handler declaration (whose exact syntax I don't have handy)

 
you need to go into Apache's httpd.conf file and look for some lines talking about MIME types and specifically syntax using &quot;AddType ....blah...blah...&quot;

Here are the lines you add to make Apache process php files to begin with (copied straight from my httpd.conf file):


AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .phtml

perhaps your fix is to just add this line:

AddType application/x-httpd-php .html
 
you may also want to check another file called mime.types that gets written to by the &quot;AddType&quot; lines that are part of httpd.conf file (my &quot;mine.types&quot; file was in Apache's conf directory, same directory where you find &quot;httpd.conf&quot;)

also, from my previous post, there may be slightly different syntax that should be used (saw this in another post from someone else):

<IfModule mod_php4.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html .htm
AddType application/x-httpd-php-source .phps
</IfModule>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top