Table of Contents

The following applies to the Apache web server. Sorry, I have no knowledge about how other web servers operate.

Any page that has comments includes PHP code your web server must pass the page to the PHP processor before sending the page out to the visitor’s browser. A server configuration entry tells your server which types of pages to send to the PHP processor.

The default file extension is usually .php. So one way is to give each page that has comments a .php file extension. Example: guestbook.php

Another way is to instruct the server to send .html pages to the PHP processer. You do this by editing your .htaccess file (called dot htaccess because the first character is a period). This results in higher overhead for your server because the PHP processor will then be examining every page, even those without PHP code in them. But if you are adding comments to many different existing pages, it results in less work for you.

If you want the PHP processor to look at .html pages, add the below statement to the .htaccess file. Make a backup copy first.

AddType application/x-httpd-php .html and/or if you have .shtml pages
AddType application/x-httpd-php .shtml

The .htaccess file is in the HTML root directory on your server (where your home page resides which is usually directory name htdocs, public_html or www). If it does not already exist you can create it with your text editor. Make sure you save it as text with filename “.htaccess” then upload it to your server.

After uploading the file, browse to your site. If you get a 500 error you’ve made a mistake in the file and need to either correct it, delete it or upload your backup .htaccess file.