I am using xampp on my windows xp system and have a serious problem. I can get php to work and I can get html files to work but when I add even the simplest of php code to the simplest of html code, the php portion will not work. Is this because I am using win xp? apache is running as a service as is my mysql. I understand that I can probably do everything in php, but it is just easier code to read in html and use php when needed. I could get a free website and test off that, but I would rather not waste band or space if I could test on my computer first.
As you have gathered I am green to apache/mysql/php and any help would be greatly appreciated.
With just HTML in the file you need a .html extension. With any PHP added to the HTML you need a .php extension.
You can configure your server to process files with the .html extension as PHP, but then it will parse all HTML files unnecessarily unless you take additional steps to prevent it. More trouble than it’s worth, IMO.
In Apache, you’re going to have to look for and edit a file called /etc/httpd/httpd.conf
That file will contain a line that reads:
AddType application/x-httpd-php .php .php3 .phtml
When you find it, add .html to it and restart the server. You should then be able to parse .html files containing PHP scripts as if they were .php files.
Alternatively you can add that line to the .htaccess file