De-crufty PHP Movable Type goodness

Well, as per MarkPilgrim’s instructions and with a little help from Dave Dribin’s @MTEntryShortTitle@ plugin, my URL’s should be a little more user friendly, and a little more future-proof. Getting Apache to handle my files as PHP without file extensions was more work than it should of been – conventional wisdom has it that Apache’s DefaultType directive should of worked:

DefaultType application/x-httpd-PHP
This should match any files not already assigned a MIME type and handle them as PHP. Something about my ISP’s setup didn’t allow this (I suspect something in the site-wide configuration was already assigning a MIME type for files without a suffix), so instead I had to use the ForceType directive:
	

ForceType application/x-httpd-PHP

ForceType overrides any MIME assignments for the files that get matched by the surrounding FileType. Anyway, it all seems to be working, but if anything looks bust then please let me know. I am now including my sidebar using PHP – this means I can rebuild my sidebar once (as opposed to once per page that gets rebuilt), and it gets included on each page on request. Now that I’ve radically improved the efficiency of page rebuilding (and I suspect there are more improvements to come) I’m more able to look at some other more computationally expensive features for the blog.

This entry was posted on Monday, April 26th, 2004 at 10:16 pm and is filed under Blogging. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

4 Responses to “De-crufty PHP Movable Type goodness”

His name is actually Mark Pilgrim. Just FYI. :)

Gah! I had Dave’s on the brain obviously. Changing it now…

That’s not working for me on my site. Are you doing dynamic publishing? I got rid of all files except for static index.html home page which was great, but now I’m having a heck of a time with the extentionless archives containing PHP being processed correctly. The PHP doesn’t get parsed, and it doesn’t show up as raw text either. Any ideas? Nobody seems to be addressing this particular situation, lots of cruft-less URL posts but none with 3.x and dynamic publishing.

I’d not using MT’s dynamic publishing – I’m serving up PHP, but it’s statically generated. It was a bit of a pain to get files without the .php suffix serving as PHP, but the ForceType thing did seem to sort it. The fact that the PHP isn’t showing up as raw text is very odd.

To be honest I’m not sure how dynamic publishing should affect this, as MT is still serving up PHP which Apache has to process, but the fact that you’re not even seeing the raw PHP in the rendered HTML does lead to the possibility that MT is playing around here. As a test, try generating a static PHP page without the PHP suffix, and see if that gets processed correctly.

Have your say





Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:

URIs must be fully qualified (eg: http://www.domainname.com) and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.