HTML to PHP : Converting MT
Áine on December 30th, 2003 filed in MovableTypeThis will be the first of a series of posts about how to do specific things in MovableType. I’m no wiz at this, but in my fooling around, I’ve picked up a few things along the way. This task is one of them.
Step 1 : Determine whether your webserver has PHP installed. All good? Proceed.
Step 2 : Login to the Admin Console of the blog you wish to convert to PHP
Step 3 : Open up Weblog Config (the left menu provides a button)
Step 4 : At the top of the page, click on Preferences
Step 5 : Scroll down the page a bit. Change your Archive File Extension to php (without the leading period), and save. Select the “Archiving” link, and check to see if any of the Archive Filename boxes are filled in - if so, change the extension to .php there as well. Do NOT rebuild - you have a few more changes to make.
Step 6 : Open your Templates screen and select your Main Index Template. Change the “Output File” extension to .php. Save. Again, do NOT rebuild.
Step 7 : Return to your list of templates. Select your Master Archive Index and change the “Output File” extension to .php. Save.
Step 8 : Rebuild ALL files.
Step 9 : Open up your FTP program and navigate to the directory of the weblog you were just fiddling with. Inside it’s directory, you will find index.html. Delete the index.html file, but not the index.php file (leave that one alone). You may also see a file called archives.html, delete this but leave archives.php alone.
Step 10 : In step 8, when you rebuilt, you created duplicates of all of your entry pages (one set with .html and one set with .php); to save space, you might want to delete those .html files, but if you do, people will receive a 404 error when trying to follow old links! If you want to delete those files, it’s a good idea to investigate making a custom 404 error page that tells people they can change the file extension on the link to .php to find what they’re looking for.
There are also alternative ways of doing this. The MT Wiki site details some ways to do this (at the next link), as well as the method used above to convert your blog to PHP.
Needless to say, it is much easier to convert a blog when you first install it (while it has no entries) than it is afterwards, but it’s not an impossible task.
Technorati Tags: MovableType












December 31st, 2003 at 12:56 am
Evil Queen, nice work! I like the mini tutorial on converting to php. It’s something I have contemplated but have not committed to doing yet. Mainly for the skinning aspect as a benefit of conversion.
It’s sorta like converting from IBM to MAC. Just can’t change! ARRGGG. LOL.
Just wanted to say hello to you! Have a great New Year!
James
December 31st, 2003 at 1:00 am
Changing to PHP is very useful now you have all the benefit of php includes. When I changed over it gave me the ease of having my sidebar as a separate index template and php include it into every other page. This way I can edit my sidebar without editing every page !
December 31st, 2003 at 5:33 am
Helpful tutorial Aine. Very helpful indeed. I was wondering to do to the index.html in the weblog directory. Well who knows if next year I finally make the necesary changes.
February 12th, 2004 at 4:17 pm
Aine, your tutorial was clear, helpful and lucid! Thank you very much.
May 6th, 2004 at 4:33 pm
Evil Queen, I followed these directions, and the resulting page with the PHP extension gave me a 500 error. I looked this up in some MT tutorials on PHP and it said to add the following line to my MT.CFG file
HTMLPerms 0777
While it’s great they said “add the following line,” they didn’t say where. As the cfg file seems to be a long nested set of commands, I placed it at the end, and my entire blog was no longer viewable.
I use POWWEB.com as my host provider. I’m fairly proficient at MT. It’s set up fine and has been for some time. I need to switch to PHP to use the includes feature so I, too, don’t have to go editing headers, footers, navigation panels, etc on every single page when there is a change.
Any idea what could be going wrong?
May 6th, 2004 at 5:07 pm
# In addition to controlling permissions via umask settings, you can also
# use the HTMLPerms and UploadPerms settings to control the default
# permissions for files created by the system (either as output files or
# uploaded files). The only real use of this is to turn on the executable bit
# of files created by the system–for example, if MT is generating PHP files
# that need to have the executable bit turned on, you could set HTMLPerms
# to 0777. The default is 0666. You should not change these settings unless
# you know what they mean, and what they do.
Line 135 and Line 136 of the MT.cfg file show the following in a default installation:
# HTMLPerms 0777
# UploadPerms 0777
Note that they are commented out, normally. Try changing your MT.cfg file back to the default one, and then uncommenting out (erasing the # symbol) in front of the two lines above in MT.cfg.
I say try reverting back to the default MT.cfg file because you may have inadvertently erased or changed something else about the file which is causing it to no longer work.
I never changed the MT.cfg file in any of my blog installations in order to convert my blogs to PHP.