Neil Turner's Blog

Blogging about technology and randomness since 2002

PHP

I’ve just been dabbling in PHP. Ciaran finally got back to me over an email I sent him a few days ago asking how to make the Apache web server treat .html files as PHP files (I knew it was possible, it’s just I didn’t know the MIME type and couldn’t be bothered to find it out). The reason? Mainly because I wanted the BlogRolling links to be included in the page source and not appear as tag-on scripts; that way the page loads faster (particularly on slow connections like mine).
The problem is that there’s an incompatibility between PHP and XHTML. The PHP Apache modules sees the XML declaration and thinks it’s a line of PHP markup. So it tries to execute it, but falls flat on its face in the process. So, instead of seeing this weblog, you would have seen a nasty PHP error…
The next thing I tried was changing < to & #60 ; , but this meant that the XML declaration was displayed with the code. Grrr.
Just when I was losing patience, I came across The PHP Manual. This explains what to do (add the XML declaration as a piece of PHP code), which finally worked. Phew.
So, the BlogRolling links are now included in the source HTML, which will hopefully raise the PageRanks of those sites that I link to. Isn’t that kind of me? ๐Ÿ™‚

Comments are closed.