Installing Textpattern on Tiger

The Standards CMS


Matt Willmore Skip to comments 39 Comments (Comments Closed Closed)

Matt Willmore teaches you the basics of getting the open source blogging engine TextPattern installed on your Mac running OS X 10.4 Tiger.

Once again, we're covering weblog publishing. You may ask yourself, Why do these nutjobs keep covering blogging packages? The short answer is that it needs to be done. And the long answer? As Mac users, we are all familiar with choice: the choice of computing platform, the choice of browser, the choice of e-mail client. Now that the "market" of weblog software has exploded, we have choices there too. As with every tool, there's a right one for every job. Each blogging package has a different set of features that appeals to each of us. That's why Justin uses Movable Type and I use WordPress. Now, there's yet another solid contender - Dean Allen's Textpattern. This tutorial will explain, step-by-step, how to install Textpattern 1.0rc3 on Mac OS X 10.4 Tiger.

What does Textpattern offer? As it turns out, plenty. Among the coolest features, Textpattern includes the Textile tool, which auto-magically takes plain text from a blog entry and whips it into valid XHTML. Also, referrer logs are built-in and dynamically up to date. Combine that with an extremely flexible interface and options for publishing, and you get a very robust publishing platform for anything from a private journal to a corporate blog. Check out some sites out there that are Textpattern-powered:

Now that we've seen just what Textpattern can do, let's get it running. Although there is an incredible amount of customization that can be applied to Textpattern to achieve the adesign and function you require, the scope of this tutorial is limited to installing and configuring Textpattern so you can be up and publishing in no time. Let's do this!

NOTE: If you already have something installed (such as another blogging package) that uses MySQL and/or PHP, you can skip to step 4.

  1. Downloading and Installing Textpattern 1.0rc3
  2. Enabling Personal Web Sharing
  3. Downloading and Installing MySQL
  4. Configuring MySQL
  5. Enabling and Testing PHP
  6. Configuring Textpattern

Downloading and Installing Textpattern 1.0rc3

Downloading Textpattern is easy. The direct link can be found from Textpattern's download page. After you download it, decompress the file; OS X should be able to handle it without incident. You will now have the folder current. We'll place it into Apache's root directory for serving pages. Navigate to and open /Library/WebServer/Documents.

At this point you have a couple of options. If Textpattern will be served at the root of the site (say, www.maczealots.com), you'll want to move the contents of the current folder into the Documents folder. However, let's say you want to run Textpattern from inside a directory - say, www.maczealots.com/blog - in that case, you'll want to rename the folder current to the desired name and move the whole folder into the Documents directory. In this example, I'll rename the folder "blog" and drop it in the root folder. Copasetic so far? Let's keep going.

Enabling Personal Web Sharing

"Personal Web Sharing" (PWS) is Apple's marketing name for Apache, the industrial-strength, tried-and-true Web server du jour. When you enable PWS, OS X starts up Apache, registers the modules, opens ports, etc. Since we'll be serving the blog, we'll need to have Apache running.

To enable Personal Web Sharing, open the Sharing preference pane in System Preferences. Check the box labeled "Personal Web Sharing", and that's it. (You may have to authenticate as an administrator before it will let you enable anything.) Go ahead and close System Preferences; you're ready to install MySQL now.

Note: We are working on a version of this tutorial that includes the ability to host the database with SQLite, which is prepackaged in OS X 10.4. However, support for SQLite in Textpattern is still being developed, so for now MySQL is still the way to go. If you'd like to see such an article, let us know.

Downloading and Installing MySQL

MySQL is the database backend that Textpattern uses to store blog entries, users, comments, etc. MySQL is free for personal use. First, download MySQL (4.0.24 at the time of publication). It will come as disk image with two packages and a readme. We will be installing both packages. First, open the main MySQL installer. It will install all the necessary components to run MySQL onto your OS X volume. After that installer has completed, run the startup item installer, which will automatically start up MySQL after any computer restarts.

Note: One of the most common problems reported is that people install MySQL 4.1 instead of 4.0. I can understand the desire to be on the bleeding edge of software, but Textpattern (and most other blog/CMS engines) use an older authentication scheme that is incompatible with MySQL 4.1 and greater. There are hacks and workarounds out there, but for the easiest installation, stick to MySQL 4.0.

Configuring MySQL

Now that you have installed MySQL, let's configure it so Textpattern can access it. Open a new terminal session (found in /Applications/Utilities/Terminal.app) and type the following commands to navigate, make some changes, and start the MySQL daemon:

cd /usr/local/mysql
sudo chown -R mysql data/
sudo echo
sudo ./bin/mysqld_safe &

Next, let's launch MySQL and use the test database (called test, even) to make sure everything's running correctly:

/usr/local/mysql/bin/mysql test

If everything's running correctly, you should see output similar to this:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version 4.0.24-standard

Type 'help;' or '\h' for help.  Type '\c' to clear the buffer.

mysql>

Once you've verified that MySQL is running correctly, use the command quit to return to the console prompt.

Now that MySQL is running, we'll change the root password of MySQL so that Textpattern (and you) can access it later. Use this command (where yourpasswordhere is replaced by your chosen password):

/usr/local/mysql/bin/mysqladmin -u root password yourpasswordhere

Now we'll create a database in our MySQL install for Textpattern (and name it textpattern, appropriately). This is the last step in the MySQL configuration, as Textpattern will automatically populate the database during setup.

/usr/local/mysql/bin/mysqladmin -u root -p create textpattern

Enabling and Testing PHP

Now that MySQL is ready to go, let's fire up PHP. OS X ships with PHP installed, but it is not activated. Fortunately, this is really easy to do. The only file we'll need to edit is httpd.conf, which Apache uses for its configuration.

Open the config file in your favorite editor (I'll be using pico):

sudo pico /etc/httpd/httpd.conf

Mosey on down to the Dynamic Shared Object (DSO) Support section. It's the one with all the LoadModule listings. The one for PHP 4 is towards the bottom of that list. Look for the line and uncomment it to activate it. You can uncomment a line by removing the pound symbol ("#") from the beginning of the line. The new line should look as such:

LoadModule php4_module

We'll also need to uncomment the PHP 4 entry in the AddModule listings, so that it looks as such:

AddModule mod_php4.c

Once those two lines are edited you can save the httpd.conf file and quit the editor. Since we've edited Apache's load setup, we need to restart Apache so it will recognize the changes:

sudo apachectl graceful

With that out of the way, let's make sure that PHP is indeed running. Create a new text file in your favorite editor (stay away from RTF-happy TextEdit, though - SubEthaEdit gets my vote) and fill it with the following text:

<?php
phpinfo();
?>

Save the file as test.php in the root directory (/Library/WebServer/Documents/) and load the address of the page (usually http://localhost/test.php) into a Web browser. If PHP was correctly enabled, the phpinfo(); command should output page after page about the PHP installation. If not, retrace your steps - it can be easy to make a mistake.

Configuring Textpattern

This part was really simple, it actually tricked me at first. As stated on the Textpattern site, we need to edit Textpattern's MySQL configuration. How easy is this? Try opening a Web page. Open your browser and navigate to the setup.php file in the textpattern directory. Using my example, the URL would be http://localhost/blog/textpattern/setup.php. When that page loads, fill in the appropriate information [screenshot]. Once you're done, click the Next button.

The next screen you will see will have a text box with a small amount of text to copy into Textpattern's config.php.default file [screenshot]. Simply select the text and copy it. Then, open the file (located at /Library/WebServer/Documents/blog/textpattern/config.php.default in my example) and replace the contents of the file with what you copied from the Textpattern setup page. Save the file as config.php (make sure to lose the .default). Then, go back to the Texpattern setup page and click I did it to finish the installation.

Now that everything is installed, Textpattern will present the first of two final screens asking for your account information [screenshot]. Simply enter the full name, username, password and e-mail address, and click Next.

The last screen you have instructs you to go back to the textpattern directory and delete the setup.php file [screenshot]. This prevents people from accessing that file and messing with the database settings and breaking your installation. Once that's done, click the "main interface" link on that page to be taken to Textpattern's login page [screenshot]. That's it! Textpattern's ready to go.

If you have any questions or problems with Textpattern, Dean maintains a healthy forum on the Textpattern site where you can ask questions, request features for upcoming releases of Textpattern and even show off your Textpattern-powered site to the rest of the Texpattern community. Happy publishing!

Matt WillmoreMatt Willmore is a founding partner of MacZealots.com. Matt is also a Resident Assistant at Owen Hall and does Mac support at ECN, and is active in PUMUG. He can be reached at .

Reader Comments (39)

DISCLAIMER: The views expressed below are those of their authors and not necessarily endorsed or supported by MacZealots.com. In all cases, the comments provided here are offered as a courtesy and will be moderated. Any content deemed off-topic or offensive will be removed without notice. Posting a comment here boils down to two things: 1.) Think before you type 2.) Respect the thoughts of others. See our commenting guidelines and/or privacy policy for more information.

1 AKB remarks:
#1) On October 1, 2004 1:30 PM

if you want to be able to do ‘clean’ URLs (rather than yoursite.com/index.php?blah) you need to do another edit to the httpd.conf file. Find the text ‘AllowOverride’ and change ‘None’ to ‘All’. Until I realized I had not made that change I was banging my head against the wall wondering why I could not get the .htaccess edits to take effect.

2 mattmikulla remarks:
#2) On October 1, 2004 5:14 PM

I am a little confuse about the importance of a few directories.

I can view my info.php documents fine in my macintosh HD/users/mattmikulla/sites/info.php directory.

What is the difference between that and the Macintosh HD/Library/Webserver/Documents/ directory? I placed a copy of the info.php in the documents folder and I can’t open it by going to file > open in safari. It is not selectable.

3 Matt Willmore remarks:
#3) On October 1, 2004 6:45 PM

Matt -

The /Library/WebServer/Documents directory is where Apache looks for the root folder for your site (mysite.com, for example). On the other hand, the Sites folder in your /Users/username directory can be accessed via adding a tilda and the username after the domain - on the local machine for you, that would be http://localhost/~mattmikulla.

I have run into the same problem as you regarding Safari not recognizing the file. In that case, simply accessing the page via the URL has always done it for me. Remember, all Safari knows is HTML. Apache works the PHP code, not the browser. When you request a .php page from a site, PHP generates HTML based on the script and pushes it to the browser.

4 OneMoreBlogThing remarks:
#4) On October 21, 2004 5:15 AM

But there is one more blog thing: nanoblogger.sourceforge.net (for the Unix savvy)!

5 Etuka Onono remarks:
#5) On October 26, 2004 6:37 AM

I’ve editted the .conf file as suggested, entered

“/Library/WebServer/Documents/index.php”

and

“/Library/WebServer/Documents/”

in Safari, but both simply call up Finder and display the contents of that directory. The changes to the .conf file look OK - what can I check to see what is going wrong?

6 Scooter remarks:
#6) On October 27, 2004 6:08 PM

Okay, I followed the directions down to the letter and Textpattern worked beautifully when installed in my web server’s document root directory. Unfortunately, the same cannot be said when setting up Textpattern somewhere else. The problem is this, I want to put up a blog site that is vended from /User/scooter/Sites and has the URL http://mydomain/~scooter. I installed Textpattern in /User/scooter/Sites, I was able to set it up by going to http://mydomain/~scooter/textpattern/setup.php, and after creating my config.php, I could log in as admin and modify the site settings by going to http://mydomain/~scooter/textpattern/index.php, but when I view the actual blog page at http://mydomain/~scooter/index.php, it’s missing all the stylesheet information.

Has anyone got Textpattern to work correctly from a user’s Sites directory? Is there any special configuration necessary?

p.s. The config.php has the following paths set:

$txpcfg[‘txpath’] = ‘/User/scooter/Sites/textpattern’;
$txpcfg[‘doc_root’] = ‘/Library/WebServer/Documents’;

7 P.Compton remarks:
#7) On November 2, 2004 4:23 AM

“I’ve editted the .conf file as suggested, entered

“/Library/WebServer/Documents/index.php”

and

“/Library/WebServer/Documents/”

in Safari, but both simply call up Finder and display the contents of that directory. The changes to the .conf file look OK - what can I check to see what is going wrong?”

I am having the same problem. I have run the steps three times with no solution. Any help would be appreciated. Cheers.

8 Matt Willmore remarks:
#8) On November 3, 2004 11:45 PM

Paul -

Instead of typing the file path, access the page via Apache, so the PHP will be interpreted:

http://localhost/index.php

9 c remarks:
#9) On November 6, 2004 6:09 AM

Scooter, did you set Subdirectory to /~scooter/? I had the same problem because I had /~username/ in the Web Domain field. See also this Txp forum thread.

And Matt, thanks for this great guide!

10 Cedney remarks:
#10) On November 17, 2004 5:57 AM

I am having issues. I got the following message:

maclap:~ root# /usr/local/mysql/bin/mysql test
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
maclap:~ root#

11 John Alderson remarks:
#11) On May 19, 2005 12:04 AM

Matt (or someone else) - help!

I’ve followed all the steps, and backtracked to double check. I renamed the ‘current’ folder ‘blog’ and placed it in Macintosh HD (alongside Applications folder, Library folder etc). MySQL is configured (Terminal confirmed this) and the httpd.conf file is saved with those two lines uncommented.

I created a text file called index.php as suggested. when I drag & drop this into a browser (Safari or IE), nothing happens. in fact, when I drag & drop any of the .php files in the textpattern folder, same thing - nothing happens.

where have I gone wrong? is PHP not enabled after all? is this an Apache issue. I D/L-ed most or all of this stuff tonight, and am a complete novice (who’d love to get this working).

puhlease help! thanks in advance…

12 JOHN remarks:
#12) On May 19, 2005 12:27 AM

okay! I placed the folder I renamed ‘blog’ in the Documents folder within WebServer. I tried ‘http://localhost/index.php’ which worked, and ‘http://localhost/blog/textpattern/setup.php’ which also worked.

I typed in what was given in your example (root : (my password) : localhost : textpattern) and my own web address (.co.uk/blog) but got this consistent error message:

“Checking database connection…
Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /Library/WebServer/Documents/blog/textpattern/setup.php on line 111

Can’t connect to the database with the values entered.”

is it relevant that the setup screen asks me for ‘Site Path’ and ‘Site URL’, instead of two site paths as in your example?

thanks in adv!

13 Matt Willmore remarks:
#13) On May 19, 2005 2:26 AM

John -

This is more of an indicator of using a MySQL client newer than what Textpattern supports. My guess is that you installed MySQL 4.1.x. In actuality, you need to install 4.0.x - the latest right now is 4.0.24.

http://dev.mysql.com/downloads/mysql/4.0.html

Before you install 4.0.24, you’ll want to remove 4.1.

http://www.entropy.ch/software/macosx/mysql/remove-old-mysql.html

14 alex remarks:
#14) On May 28, 2005 9:22 AM

great tutorials on this site… but they are all for users of Mac OSX Client…. any chance i can find the same tutorials, but for Mac OSX SERVER? (yes, there are significant differences). if the zealots don’t consider server tutorials a worthy subject, can anybody point me to similar CMS tutorials, but for OSXserver? thanks!

15 Dr. A. N. Feldzamen remarks:
#15) On May 28, 2005 1:02 PM

I bought Quicktime Pro a while ago, and got registration number, etc. For that I PAID MONEY !

Then I bought TIGER. Now my new Quicktime 7 no longer has the Pro features. I tried to install the Serial Number I got when I PAID MONEY for Quicktime Pro, but TIGER will not accept it. Older versions of Quicktime will not work, I am told, with TIGER.

So I called the Apple Store. I got told, TOUGH LUCK! BUY IT AGAIN!

Disgraceful! I feel CHEATED BY APPLE!

Was I ROBBED by APPLE?

Dr. A. N. Feldzamen
3 Arrowood Lane
Ithaca, New York 14850-9793
607-257-8080
alfeld@twcny.rr.com

16 Matt Willmore remarks:
#16) On May 30, 2005 12:09 AM

Dr. Feldzamen –

When did you buy your QuickTime license? Apple’s usually pretty good about providing free upgrades when the purchase date of the old license and the release of the new version are fairly close (20-30 days). However, if it was longer than that, then you’ll probably have to buy the new version. You may not remember, but the same situation happened when QuickTime 5 was released in 2001 – QT 4 Pro license users were forced to buy new licenses.

17 stefzeed remarks:
#17) On June 3, 2005 4:50 AM

hi thanks for all your information.
I am moving a easyphp site from pc to mac..
How do I change the config.php
I have for the pc : c:\easyphp1.8\www\multimedia
on the mac what should be the synthax…
My site is at the folder ‘Sites’ on tiger os10.4

18 Wolasi remarks:
#18) On June 3, 2005 6:57 AM

Hi Matt,
Great tutorial. However, I’m having problems uploading/viewing images in the images folder. Textpattern gives me the following error message: “Warning: cannot write to image directory
/Library/WebServer/Documents/blog/images/. Please change file permissions to 777.” Any suggestions? Thanks.

19 Conti remarks:
#19) On June 8, 2005 3:55 PM

Hello
I’m trying to follow your very good guideline.
Unfortunately I run in problems in the section 4 “configuring MySQL”.
After the second terminal comand “sudo chown -R mysql data/” I get a message with something like


We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

Password:

How I have to proceed ? I don’t know whitch password to use.
Could someone help me.

Thanks in advance for your appreciate help.
Conti

20 Matt Willmore remarks:
#20) On June 9, 2005 9:33 PM

Stefzeed -

The syntax should be:

/Users/[yourusername]/Sites/

…replacing [yourusername] with your OS X username. My username is willmore, so my path would be:

/Users/willmore/Sites/

21 Matt Willmore remarks:
#21) On June 9, 2005 9:38 PM

Conti -

This is simply the warning that UNIX gives you the first time you use the sudo command. The password to use is your OS X user password (of the user currently running that Terminal session).

22 Matt Willmore remarks:
#22) On June 10, 2005 10:12 AM

Wolasi -

We can get this to work without setting the permissions to 777 (full read and write access for anyone). Instead, let’s change the user to www (what Apache’s living within) and set some more moderate permissions:

cd /Library/WebServer/Documents/blog
chown www images/
chmod 775 images/

23 Matt remarks:
#23) On July 15, 2005 4:58 AM

Hi there
I got a similar error message to Cedney. When I try to launch MySql and use the test database, I get this:-

“ERROR 2002: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)”

I’ve followed everything to the letter but can’t wortk this out. Unfortuntaley I don’t have any programming experience so am stumped now. Please can someone help?

24 Matt remarks:
#24) On July 15, 2005 5:58 AM

Sorry for the double post but I now seem to have sorted my problem out. Disconnecting from the internet and restarting seemed to remedy the problems I was having. I don’t have enough programming experience to be able to say exactly what I was doing wrong, but it works now anyway.

Thanks for the tutorial - it must be good if someon like me (designer, not programmer) can follow it and get it working!

25 Sunny remarks:
#25) On July 19, 2005 5:58 AM

Worked beautifully! Thanks!

26 Conti remarks:
#26) On July 21, 2005 6:38 AM

Hello
thanks!! for the very helpfull guideline.
I have my TEXTPATTERN now up and running on my OS X machine locally for test purpose.
My question is, does someone have a tutorial or some tips and tricks on how to install or copy the local installation to a webserver ownd by an ISP ?

27 Matt Willmore remarks:
#27) On July 25, 2005 2:05 AM

Matt -

I’m glad to see you were able to work this out. This error comes about because the MySQL client isn’t running, as detailed on this page:

http://www.entropy.ch/software/macosx/mysql/#faq

I’m not sure how dis/reconnecting to the Internet solved the issue, but I’m glad it did!

28 Matt Willmore remarks:
#28) On July 25, 2005 2:11 AM

Conti -

The two major things you need to transfer from a local machine to an ISP are the folder with Textpattern and your MySQL database. To move the database you will need to export it into what is called a MySQL dump. An easy way to do this is with the great program CocoaMySQL, available for free at:

http://cocoamysql.sourceforge.net

You can export the database by selecting File > Export > CocoaMySQL dump… When you get access to the ISP’s MySQL server, import the database by selective File > Import > CocoaMySQL dump… and selecting the .sql file that CocoaMySQL made when you exported the database.

Edit the config file, and you’re ready to go!

29 Nathaniel remarks:
#29) On July 27, 2005 10:21 PM

The tutorials here are great. Thanks.
Two quick comments: 1. I believe you put “Wordpress” in this article when you meant “Textpattern” Under the MySQL test command “Now that MySQL is running, we’ll change the root password of MySQL so that WordPress (and you)”
More importantly, it took me awhile to figure out why I couldn’t use Permalinks in Wordpress or Textpattern. I changed the permissions on the .htaccess file but it didn’t make a difference. So then I finally changed the group to “www” instead of my username and now it works. I hope that was correct.
Now it set like this:
“-rw-rw—— 1 lindley www 148 Feb 20 09:47 .htaccess”
Thanks again!

30 Mark remarks:
#30) On August 18, 2005 10:52 AM

Worked perfectly! Thanks!

31 Björn remarks:
#31) On September 9, 2005 7:12 AM

Had a lot of problems getting the clean urls working on my localhost. Finally I changed my users/beakid.conf to:

&lt;Directory "/Users/beakid/Sites/">
   Options All
   AllowOverride All
   Order allow,deny
   Allow from all
&lt;/Directory>

That made it work :) Not sure if that’s the best option though, but it works for me.

32 Björn remarks:
#32) On September 10, 2005 11:41 AM

Another thing I had to do was to have a virtualhost *80 active (in the file /etc/httpd/httpd.conf). Don’t ask me why.

33 maxplanar remarks:
#33) On October 24, 2005 6:46 PM

I get this once I install the textpattern folder installed on my server:

> config.php is not ok or not found. If you would like to install, go to [/subdir]/textpattern/setup/

Any ideas?

34 maxplanar remarks:
#34) On October 24, 2005 7:33 PM

Got past that, pls ignore. New problems now. I’ll RTFM.

35 AB remarks:
#35) On November 2, 2005 6:57 AM

MaxPLanar

config.php is not ok or not found. If you would like to install, go to [/subdir]/textpattern/setup/

I have that exact same problem, and can’t get past it! What did you do?

I tried uploading in a different directory and tried setup/config.php but its not happy at all….

anyone else have any ideas?

thanks,

36 oliver Taylor remarks:
#36) On November 5, 2005 2:58 AM

So, I’m coming to this with a previous install of mysql 5. Any tips on downgrading to 4? or somehow using the new password hashing system?

I’ve looked around about uninstalling mysql5 but I’ve no luck.

37 Marcelo Burgos remarks:
#37) On November 28, 2005 8:29 AM

Thanks for the tutorial, I’ve succesfully installed Textpattern on my Mac!
The program is installed, my webpage already designed and everything. Now, how do I upload this to a ftp server? I mean, how can I make it avalable on the web?
Thank you again.

38 Stephen Carter remarks:
#38) On December 6, 2005 7:27 AM

I did not get the “Please Delete Setup.php file” message on the last step of installation. I have a sub folder called “Setup” with 4 items. Do I need to delete the folder?

Thank you for the tutorial.

39 Mutahir remarks:
#39) On December 23, 2005 1:35 AM

Great tutorials, and i got wordpress running on osx through your guidance.

A question i am getting an error when i type this command :
/usr/local/mysql/bin/mysqladmin -u root password yourpasswordhere

Can’t connect to the mysql server at local host (something )

i have tried several times and so i haven’t got a password, i downloaded phpmyadmin for mysql admin and it gives me a warning to set a password.