Marko Anastasov wrote this on March 15, 2010

Rendering Textpattern

Recently we needed to deploy a site made with Textpattern CMS by our friends from Sprawsm, along with a forum app that we built with Rails. The scenario is that a designer develops a web site locally in his Coda or similar environment, and hands it to you archived with a filled config.php a database that is ready to be imported on the server. We wanted to set the site up as a virtual host.

It wasn’t that quick and easy, as deploying a Textpattern site is basically a nonexistent term. Instead, it is usually just uploaded via FTP to a shared host. Searching for a sample VirtualHost configuration led me to the Textpattern Multi-Site Howto, which is quite noisy and suggests that you point your DocumentRoot to a subdirectory in sites/. It includes pieces such as [Textpattern will tell you to place your config.php file in /textpattern/. This is INCORRECT.[ and [it will present a link to the [main interface.[ This link will be INCORRECT, so do not click it[. Ignore that guide. In fact, remove the sites directory, unless you do have multiple Textpattern sites and you’re absolutely sure that you want to save a couple of kilobytes of PHP source code at the cost of getting lost in configuration.

This is what works for us:

/var/tpapp$ rm -rf sites
<VirtualHost *:80>
    ServerName tpapp.com
    ServerAlias www.tpapp.com
    DocumentRoot /var/tpapp
    <Directory [/var/tpapp[>
        Options +FollowSymLinks
    </Directory>
</VirtualHost>

Then in /var/tpapp/textpattern/config.php:

<?php
$txpcfg['db'] = 'tpapp_db_name';
$txpcfg['user'] = 'root';
$txpcfg['pass'] = 'rootpassword';
$txpcfg['host'] = 'localhost';
$txpcfg['table_prefix'] = '';
$txpcfg['txpath'] = '/var/tpapp/textpattern';
$txpcfg['dbcharset'] = 'utf8';
define('txpath', $txpcfg['txpath']);
?>

By the way, on Ubuntu the easiest way to get all the dependencies quickly is to install the Textpattern package, and then manually create the target database:

apt-get install textpattern

Textpattern has a screen to diagnose possible issues which you can access at /textpattern/index.php?event=diag. For example, you might’ve forgotten to enable mod_rewrite (via sudo a2enmod) on a fresh server image, or fix some simple permission errors.

comments powered by Disqus

About Marko Anastasov

Marko co-founded Rendered Text. He’s a programmer with a passion of creating something for other people, coupled with interests in how things work in the society and nature. He is having a great time working across many areas in the company, including product design, helping the engineering teams, empowering users and marketing. He likes to counterbalance it all with running, cycling or a day in the woods.

Suggested Reads

Inject is a fundamental building block

Inject is one of the fundamental, and most versatile constructs available in functional languages. It can be used to implement map, select, max, all? and a bunch of other iteration related methods. Unfortunately, many programmers are not aware of its awesome powers. This article is here to improve this fact.

Contact

Rendered Text is a software company. For questions regarding Semaphore, please visit semaphoreci.com. Otherwise, feel free to get in touch any time by sending us an email.

Rendered Text
Svetozara Miletica 10
21000 Novi Sad
Serbia