Installing a Wiki on Your iBookby Giles Turnbull
The following conversation between Mac DevCenter writer Giles Turnbull and software developer Matt Hunt (a FreeBSD fan who's very happy with the way Mac OS X turned out) walks you through a Wiki installation on Mac OS X. It's really easy to follow, and we hope you'll give it whirl.
Giles: Hi, Matt. I've been researching how to install a Wiki on my iBook. I thought there'd be a bunch of how-to documents online somewhere, but I searched all over the place and came up with not much. Could you help me out?
Matt: Yeah OK. Had you thought about which one you'd like to install? There are literally several to choose from.
Giles: Well, I've used PHPwiki before and I quite liked it. Plus the documentation says that installation is a snap.
Matt: The documentation would say that, but it is worth trying out. The first step is to download the source package. The latest source download is probably the best thing to get.
Giles: OK, I've got that, what's next?
Matt: Unpack it in the Sites directory of your home directory,
tar zxf phpwiki-1.3.4.tar.gz, and enter the newly create directory.
Giles: I did that, and went to http://localhost/~myusername/phpwiki/, and Safari just downloaded a file. What went wrong?
Matt: Whoa, there! Nothing's ever quite that simple. You need to make sure that your web server is loading the PHP module and that it will use PHP documents as index pages. You'll need to edit your Apache configuration.
Giles: That's just a text editor job, right?
Matt: Right. Edit
/etc/httpd/httpd.conf in your normal command-line text editor (vi, emacs, pico, whatever).
Giles: I tend to use vi.
Matt: Fine, you'll have to edit the file with an administrator account or with the root account; try
sudo vi /etc/httpd/httpd.conf and make sure that you uncomment (remove the
# symbol from the start of the line) these lines:
LoadModule php4_module libexec/httpd/libphp4.so AddModule mod_php4.c
They're not together in the file so you'll have to search for them. Whilst you're in there editing the httpd.conf, find the line that specifies:
and add a few more entries to it. Mine reads:
DirectoryIndex index.html index.php index.htm index.php3 index.cgi
and finally, you'll also need to tell Apache how to identify PHP files; add these lines:
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
Add them just after the comment
about AddType (# AddType allows you to tweak...) That ought to do the trick.
Giles: Hmm, OK, that wasn't too hard.
Matt: Don't forget to restart Apache when you're done. You can start and stop it from the "Sharing" panel in "System Preferences", but that would also automatically open the firewall to the outside world, which you might not want at the moment. If Apache's running already you can run:
sudo apachectl restart
from the terminal; if not you'll have to run:
sudo apachectl start
Giles: So now I'll go see my shiny new Wiki in my browser at 127.0.0.1/~myusername/phpwiki .... oh. It doesn't work. I'm getting an error. It says
Fatal error: Call to undefined function: dba_open() in /Users/gilestur/Sites/phpwiki/lib/DbaDatabase.php on line 32
Matt: Oh, that's just a fatal error. You need to store the content somewhere. The default is to use DBM files, but I find it's better to use MySQL as a datastore. It's more flexible. Do you have MySQL installed?
Giles: Nope. Tell me it's not complicated.
Matt: It's not complicated. You can download a package for it from the Apple downloads site. MySQL version 4 should do the job admirably, so get that and install it.
Giles: This is more like it. A nice easy package that I can just double-click on ... I've downloaded and installed it, and everything seems to have gone smoothly. It's put itself in
/usr/local/mysql, which I suspect is a good place for it.
Matt: Yeah, did it start the database server?
Giles: How would I know that it had?
Matt: You can ask it:
Giles: Ah right. I've asked it and it says that various things are happening--one thread, 34 questions, 6 open tables, and so on.
Matt: That sounds just fine, if it hadn't you'd have had to start the server, that is,
sudo /usr/local/mysql/bin/safe_mysqld &.
Giles: Figures. So, I've got MySQL working ... now I guess I need to tell it to start a database for the Wiki.
Matt: You're getting the hang of this now. But first you have to set a password for the "root" account on your database server.
/usr/local/mysql/bin/mysqladmin -u root password sniggle will do that, but you should choose a different password to "sniggle". As an aside, that MySQL package also contains a directory called MySQL.prefPane. If you drag that into /Library/PreferencePanes you'll get a MySQL entry on your System Preferences, which will let you start and stop the server as well as setting the master (root) password.
Once you've done that, you can set up a user in MySQL for your Wiki--do this in your terminal:
/usr/local/mysql/bin/mysql -uroot -p mysql
This starts up the MySQL command line client. Now, do this in the client:
> grant select, insert, update, delete, lock tables on wiki.* to wiki@localhost identified by 'password';
> create database wiki;
You should probably choose a different password to "password" there as well. Once you've done that, you have an empty database in MySQL just ready for your Wiki content, and a new user with permission to access and change the database.
Giles: Cool. After each of those commands, the MySQL client responded with some simple information about what had happened. Nothing too frightening. What's the next step? Something to do with PHP?
Matt: Not quite yet. There's a little bit more database stuff to do, and then a bit of PHPwiki stuff, and then it should work. First, for the database, in the PHPwiki distribution that you unpacked there's a directory called "schemas". Go there and issue this command:
/usr/local/mysql/bin/mysql -uroot -p[password you just set in mysql] wiki < mysql.sql.
That sets up the database structure for the Wiki so that it's ready for the content, make sure you specify the password you set for the root account here.
Giles: Yikes, I'm getting confused about all these passwords. There's the sniggle one, and the password one--which one do I use when?
Matt: OK, the first thing to be clear on is that these accounts are just MySQL accounts, they're not related to the Mac OS X accounts. They have passwords stored in the database server and their permissions relate to what they can do on the database server. We're just concentrating on two accounts here, the "root" account has privileges to alter all parts of all databases that MySQL knows about: it's the "superuser". The "wiki" account that we just created has very limited privileges, it can select, update, delete, and insert data only in the Wiki database. So it can't create the tables, nor delete (in SQL terms, drop) them.
Giles: Aha, so in terms of the examples we've been using so far, the "root" account password was the "sniggle" one, and the "wiki" account password was the "password" one, right?
Giles: Now I get it. Things are getting clearer. We must be nearly done now.
Matt: Yes, we're on the last lap. You can connect to the Wiki database as the Wiki user and check that your tables are there if you like:
/usr/local/mysql/bin/mysql -uwiki -ppassword wiki > show tables;
It should show something like this:
Giles: Yes, that's exactly what I get.
Matt: Great, now we just need to get PHPwiki to connect to it and we're away. There's a configuration program provided with PHPwiki--you could try
http://localhost/~yourusername/phpwiki/configurator.php, but it didn't work when I tried it.
Giles: Hmm, so there's another way?
Matt: Yes, you can edit the index.php file directly.
Giles: Fine. Which bits do I need to change and where?
Matt: All these changes are to the
index.php file in the directory of PHPwiki source that you unpacked. You have to set the admin username and password options, otherwise your Wiki will give you a warning to set them when you view pages. Set them to something convenient to you (sorry, that's yet another password to remember). The lines that you're looking for are:
if (!defined('ADMIN_USER')) define('ADMIN_USER', ""); if (!defined('ADMIN_PASSWD')) define('ADMIN_PASSWD', "");
just add the username and password between the quote marks at the end of the lines. For example,
if (!defined('ADMIN_USER')) define('ADMIN_USER', "wikiadm"); if (!defined('ADMIN_PASSWD')) define('ADMIN_PASSWD', "admpassword");
The other important thing to do is to let the Wiki know where it can find the database. Find these two lines in the file:
//'dbtype' => 'SQL', 'dbtype' => 'dba',
and change them to:
//'dbtype' => 'dba', 'dbtype' => 'SQL',
//'dsn' => 'mysql://guest@:/var/lib/mysql/mysql.sock/test',
and add this line below it:
'dsn' => 'mysql://wiki:password@localhost/wiki',
Change that to match the details of the user that you created earlier. For example, replace the first "wiki" with the username, "password" with that user's password and the final "wiki" with the name of the database, if you changed it.
And that should be all you need. You can find the line containing
define('THEME', 'default'); and change 'default' to 'MacOSX', if you'd like your Wiki to blend in a little.
Giles: Great. So having made all those changes, my Wiki will now work?
Matt: Yes, it should. Try it.
Giles: OK, so all I need to do is start up my browser--I'll use Safari--and send it to
http://localhost/~myusername/phpwiki ... and it works! I've got myself a wiki home page (see below).
Matt: Phew! Remind me why you wanted one again?
Giles: After all that, I've forgotten. No, only kidding. I wanted to investigate using a Wiki for all sorts of things. There's a lot of discussion on the original wiki about using the Wiki concept for knowledge management (and more) on a local disk.
Matt: I've used Wiki to support collaboration before, for instance to support discussion on programming projects and share documentation on a company Intranet, but I never really thought to use it as my personal data store.
Giles: There's been talk about the idea of a personal wiki and various contributors have added their own suggested uses: recipe storage, journal writing, even as a private weblogging system. You can put a Wiki to use as a to-do list, and there are calendar plug-ins available for those who see the Wiki as a replacement for their normal PIM software.
Matt: I like that, maybe I'll use one on my desktop at work to replace the battered collection of notepads I have to search through when I need to remember something.
Giles: Yes, I can sympathize with that. One thing I'm interested in doing with my Wiki is using it as a bookmark manager. Although Safari remains my default browser, I still use Camino, Phoenix, and Mozilla quite regularly, and it would be good to be able to reach my bookmarks from within any of them.
Another possibility is keeping a journal, not just a personal diary but a record of everything I write. Because the Wiki is searchable, I can throw pieces of text into it and I don't have to worry too much about categorizing them or sorting them into any kind of hierarchy. As long as I know roughly what the text was about, I'll always be able to find it again.
Of course, it's worth pointing out that there are simpler alternatives to the process we've just outlined. One of the simplest is VoodooPad, a simple-to-install app for Mac OS X 10.2 and later, which operates just like a Wiki, but without the need for setting up any databases or meddling with MySQL and PHP.
Personally speaking, I'm a big fan of the whole Wiki concept. The idea of having a web page that anyone can edit sounds pretty strange when you first encounter it, but Wikis do work well as collaborative environments. The simplicity of their interface--edit, save, that's all there is to it--is what makes me want to use it on my own computer too.
Matt: Yes, you've given me some ideas there too.
Giles: Couldn't have done it without your help. Thanks!
Matt: No problem, well, apart from the problems. You can buy me a beer when I see you next. Cheers.
Giles: It's a deal. Bye.
Return to the Mac DevCenter.
Soks - An easier wiki
2005-08-05 10:35:58 tamc [View]
- Trackback from download-legal-mp3.tripod.com
downloading legal mp3
2005-08-02 16:43:44 [View]
Does it work with PHP5?
2005-06-03 16:20:50 bmtndog [View]
Another easy option for Wiki on the Mac: PmWiki
2004-09-25 16:32:37 jhchou [View]
mysql setup error: mysql.sql
2004-09-13 09:03:56 firstname.lastname@example.org [View]
mysql setup error: mysql.sql
2004-09-14 11:58:19 email@example.com [View]
2004-09-08 10:05:19 jhchou [View]
Installing phpwiki v1.3.10?
2004-09-14 11:56:39 firstname.lastname@example.org [View]
2004-07-16 14:22:17 [View]
More on Wikis
2004-03-22 20:45:47 [View]
2004-03-08 06:30:18 alananonymous [View]
local links are not relative
2004-08-03 14:48:04 rikahlberg [View]
2004-01-29 18:00:26 [View]
2004-01-29 14:03:27 [View]
Un excellent tutoriel sur PhpWiki
2004-01-11 06:52:13 [View]
PhpWiki install on OS X
2004-01-11 06:27:57 [View]
2003-11-19 15:03:13 anonymous2 [View]
2003-10-27 16:59:41 mickazoid [View]
2003-08-27 20:47:37 anonymous2 [View]
2003-08-27 19:56:59 anonymous2 [View]
2003-08-13 14:19:26 anonymous2 [View]
2003-07-01 05:27:44 anonymous2 [View]
2003-06-22 09:56:23 rberg [View]
2003-12-30 11:30:46 anonymous2 [View]
2003-06-20 17:50:59 dparmet1 [View]
2003-06-20 03:31:36 anonymous2 [View]
2003-06-19 04:37:52 dparmet1 [View]
2003-06-18 19:33:49 anonymous2 [View]
got all the way through and made the changes to the index.php
2003-07-24 15:05:05 anonymous2 [View]
It just got even more interesting
2003-06-18 19:43:58 dparmet1 [View]
2003-06-17 00:09:09 adam_alexander [View]
Wiki: php warnings
2003-06-17 13:15:03 matt_hunt [View]
2003-06-13 12:59:50 anonymous2 [View]
No graphics on external network
2003-06-28 19:18:53 anonymous2 [View]
re: No graphics on external network
2003-07-05 19:55:41 anonymous2 [View]
2003-06-11 15:13:39 anonymous2 [View]
2003-06-08 14:49:29 anonymous2 [View]
2003-06-17 13:23:16 matt_hunt [View]
2003-06-25 09:43:47 keith_veleba [View]
2003-06-08 02:11:25 anonymous2 [View]
So Wiki is . . . ?
2004-03-12 12:10:01 sans [View]
So Wiki is . . . ?
2003-06-10 08:08:16 salamon [View]
So Wiki is . . . ?
2003-06-17 13:28:32 matt_hunt [View]
2003-06-07 14:15:54 anonymous2 [View]
2003-06-06 23:02:53 anonymous2 [View]
2003-06-06 19:17:29 ddp [View]
2003-06-06 11:08:09 anonymous2 [View]
2003-06-06 08:05:32 salamon [View]
2003-08-14 22:15:07 anonymous2 [View]
2003-06-06 05:24:28 szpak [View]
2003-06-06 03:12:20 anonymous2 [View]
Not all Wikis are this horrid to install!
2003-06-12 14:15:44 anonymous2 [View]
2003-06-05 17:09:40 anonymous2 [View]