Self-hosted blogging with TextPattern


TextPattern is an open-source, PHP/MySQL blogging application. Note that it always renders pages dynamically, but supports caching to improve performance.


  1. In MySQL, create a database + user with full privileges to manage this database
    1. mysql> CREATE DATABASE textpattern;
    2. mysql> CREATE USER 'textpatternadmin'@'localhost' IDENTIFIED BY 'test';
    3. mysql> GRANT ALL PRIVILEGES ON textpattern.* TO 'textpatternadmin'@'localhost' WITH GRANT OPTION;
    4. mysql> SHOW GRANTS FOR 'textpatternadmin'@'localhost';
    5. mysql> EXIT
    6. # mysql -u textpatternadmin -p
    7. mysql> EXIT
  2. cd /var/www
  3. wget -c
  4. tar xzvf textpattern-4.2.0.tar.gz
  5. mv textpattern-4.2.0 textpattern
  6. http://srv/textpattern/textpattern/setup . Note that the user account you are asked to create has admin privileges
  7. Admin > Diagnostics
  8. cd /var/www/textpattern
  9. rm -Rf ./textpattern/setup/
  10. chown -R ??? 1042211 263938
  11. chmod 777 files images


The TextPattern application, ie. the administration files, live in the ./textpattern/ sub-directory, while the root of the blog only contains index.php and css.php.

An article is the stuff you write, with a title and a body. It may be further defined by setting it to one or more categories, and is necessarily assigned to a section of the site.

A section displays articles that have beeen set to it. Within a section, articles are rendered through a template and a style. Templates contain XHTML and TextPattern tags.


How to generate a static site?

If your blog doesn't change often, it's useless to run PHP and MySQL every time a user wants to read an article. You could use wget either manually or through CRON to download a static version of the site instead.

Must chown -R ??? 1042211 263938 after install?

After creating an article, it's not archived

If you changed Admin > Preferences > Permanent link mode from "?=messy" to eg. "/id/title", you must configure the web server so it handle URL rewriting to make clean URL's to the URL expected by TextPattern.

How to get clean URLs with Nginx and Lighttpd?