Forum Moderators: coopster

Message Too Old, No Replies

How to insert PHP

         

dak142

3:49 am on Apr 2, 2004 (gmt 0)

10+ Year Member



I have written a PHP script named dynamic.php. It runs fine by itself, I have been trying to insert it into a index.htm, the site root page. For some reason the code does not get parsed, what am I doing wrong?

aus_dave

3:56 am on Apr 2, 2004 (gmt 0)

10+ Year Member



You need to set up .htm files to be parsed by PHP through adding a statement to your .htaccess file like so:


AddType application/x-httpd-php .php .html .htm

This will parse all HTML files as PHP so it can be a bit inefficient on large sites if you have HTML files without PHP as well. Alternatively just rename index.htm to index.php (delete index.htm and your server should recognize the right index file). If not add this to .htaccess:


DirectoryIndex index.php index.html

dak142

4:05 am on Apr 2, 2004 (gmt 0)

10+ Year Member



Is this something I would have to have my hosting company make? I tried to change the extension and it still did not parse the code.

aus_dave

4:39 am on Apr 2, 2004 (gmt 0)

10+ Year Member



You need to upload a text file called .htaccess to your root directory and add the lines above to it. Do a search here, there should be a lot more information if you need it :).