Converting my website to PHP


01.04.2019

This website used to be static and I used to use an ugly shell script to compile it from a markdown mask. Recently I decided that mentioned shell script is basically un-maintainable, at least not if I want to keep my sanity. I tried rewriting it as a dedicated C program, but that quickly became tiresome.

So I am currently trying to host my site in a non-static way. I tough about writing it in Go, but then I would have had to switch my hoster and I am a bit lazy regarding web stuff. So I am now trying to use PHP, a language disliked by many (if we can trust r/programmerhumor), which is basically used all over the web for basic server side computation.

And I could not have chosen a better date for it...

My first experience is actually rather nice: I recreated my website in about a night and an afternoon (The shell script generator I used before was the product of months worth of fiddling). The entire website now only consists of PHP scripts, not a single HTML file in sight. This apparently leads to a very nice directory structure, another win in my book. The PHP files are also quite readable, so I can easily add new features or refactor my most likely terribly inefficient code.

Obviously this is rather inefficient compared to a static website, as each page has to be generated whenever it is loaded instead of once before I push my local changes to the server. Well, with about five people visiting my site every year (rough guess based on ... nothing since I am sane and do not track any visitors), I doubt it will make a huge difference. I might go back to a static site, but then I will for sure write the generator in an appropriate language, that easily works with HTML and strings in general. So basically PHP.

[Top]