This page tells you how to create the MySQL database and the config.php script if you can't run the Perl scripts which came with the Tavi package, which would do that for you.

Creating the database

There are two ways to do that.

Creating the config file

You can edit this simple file on your own, and put it in the root directory of your tavi. The file must be named config.php.


<?php

// config.php
//
// This file was generated by the install/configure.pl script based
// on values entered by the administrator.  It contains the most
// common (and vital) configuration parameters for WikkiTikkiTavi to
// run.
//
// You may edit this file by hand or use configure.pl to generate a
// new copy.
//
// Certain other settings may be configured; look in lib/defaults.php
// to see them.  Rather than changing them in lib/defaults.php, you
// should copy them from there to here.  The settings here will safely
// over-ride those in lib/defaults.php.

// $Admin specifies the administrator e-mail address used in error messages.
$Admin = 'yourmail@mail.com';

// If $DBPersist is not 0, persistent database connections will be used.
// Note that this is not supported by all hosting providers.
$DBPersist = 0;

// $DBServer indicates the hostname of the database server.  It may be
// set to '' for the local host.
$DBServer = '';

// $DBName indicates the name of the database that the wiki should use.
$DBName = 'wiki';

// $DBUser indicates the name of the database user.
$DBUser = 'wiki';

// $DBPasswd indicates the password to use for database access.
$DBPasswd = 'mypassword1';

// $DBTablePrefix is used to start table names for the wiki's tables.  If your
// hosting provider only allows you one database, you can set up multiple
// wikis in the same database by creating tables that have different prefixes.
$DBTablePrefix = 'wiki_';

// $WikiName determines the name of your wiki.  This name is used in the
// browser title bar.  Often, it will be the same as $HomePage.
$WikiName = 'MyWiki';

// $HomePage determines the "main" page of your wiki.  If browsers do not ask
// to see a specific page they will be shown the home page.  This should be
// a wiki page name, like 'AcmeProjectWiki'.
$HomePage = 'MyWiki';

// $InterWikiPrefix determines what interwiki prefix you recommend other
// wikis use to link to your wiki. Usually it is similar to your WikiName.
$InterWikiPrefix = 'MyWiki';

// If $EnableFreeLinks is set to 1, links of the form "((page name))" will be
// turned on for this wiki.  If it is set to 0, they will be disallowed.
$EnableFreeLinks = 1;

// If $EnableWikiLinks is set to 1, normal WikiNames will be treated as links
// in this wiki.  If it is set to 0, they will not be treated as links
// (in which case you should be careful to enable free links!).
$EnableWikiLinks = 1;

// $ScriptBase determines the location of your wiki script.  It should indicate
// the full URL of the main index.php script itself.
$ScriptBase = 'http://localhost/tavi/index.php';

// $AdminScript indicates the location of your admin wiki script.  It should
// indicate the full URL of the admin/index.php script itself.
$AdminScript = 'http://localhost/tavi/admin/index.php';

// $WikiLogo determines the location of your wiki logo.
$WikiLogo = 'http://localhost/logo.gif';

// $MetaKeywords indicates what keywords to report on the meta-keywords tag.
// This is useful to aid search engines in indexing your wiki.
$MetaKeywords = 'wiki personal';

// $MetaDescription should be a sentence or two describing your wiki.  This
// is useful to aid search engines in indexing your wiki.
$MetaDescription = '"This is my wiki"';

// TemplateDir indicates what directory your wiki templates are located in.
// You may use this to install other templates than the default template.
define('TemplateDir', 'template');

// !!!WARNING!!!
// If $AdminEnabled is set to 1, the script admin/index.php will be accessible.
//   This allows administrators to lock pages and block IP addresses.  If you
//   want to use this feature, YOU SHOULD FIRST BLOCK ACCESS TO THE admin/
//   DIRECTORY BY OTHER MEANS, such as Apache's authorization directives.
//   If you do not do so, any visitor to your wiki will be able to lock pages
//   and block others from accessing the wiki.
// If $AdminEnabled is set to 0, administrator control will be disallowed.
$AdminEnabled = 1;
?>


Comments

I have tried this, because I don't have shell access (but do have PERL) so cannot install the usual way. I've used RickVanLieshout/InitDatabasePHPScript - and confirmed using phpMyAdmin that the tables have been created. Yet WikkiTikkiTavi is not working, giving me a "Error executing database query." - I've double checked my mySQL access names, so I don't think its a typo there. The admin script is working when I first access it, but when I click on a link it gives the same error. I have Wakkawiki on the same system and it is accessing the database no problem. Any help appreciated.


Be sure you have written the EXACT url of your site in the $ScriptBase? variable, if this is wrong (ie: no localhost, but http://my.site.com/wiki.php) tavi doesn't work at all. -- MassimoI


Thanks for the help. However, my $ScriptBase? variable is correctly set up so this cannot be the cause, any other ideas? (my site is http://nontroppo.org/tavi/index.php) -- IanAndolina


i have the same problem -- acer

http://acer.digitalhost.net/wiki/index.php)


You might modify the file lib/db.php to give a more verbose error message. Locate the spot where the script die()s (it was line 30 here), comment it out and insert something like

    if(!($qid = mysql_query($text, $this->handle)))
      { die("$ErrorDatabaseQuery <p> $text </p>"); }

Now you can see what the database answered (e.g. "access denied" or "too many connections") and act upon it.


The error message is "LOCK TABLES wiki_rate WRITE". That is the message I got.


i got the same error caused by wrong table prefix labelling, i corrected by checking and fixing the tables name reflecting the config.php -- Sandro Pons


Your database user should have the LOCK TABLES permission on the tavi database. --John-Mason P. Shackelford


I have the same "LOCK TABLES rate WRITE" problem and giving my MySQL user LOCK TABLES permission did not help. However, commenting out both lines of fuction lock() in pagestore.php as well as some heavy edits to the rate.php stuff made the problem go away. I'm sure I'll discover the side effects of my tinkering soon enough... --JustinWSmith


I had followed the TaviInstructions but, not having perl, had chosen for TaviNoPerl, with $DBTablePrefix? = 'wiki_' -- the default.

Then I created the tables, with $prefix = "" -- again, the default.

Result: tables in MySQL without prefix, request for locking a table with prefix.

Resolution: change $DBTablePrefix? = 'wiki_' in config.php into $DBTablePrefix? = ''.

Peter J. Veger

//I encountered the same case, I changed $DBTablePrefix? = 'wiki_' into $DBTablePrefix? = '' and found it works.


If the file above, config.php is in the root of the wiki, and it contains this entry

// $DBPasswd indicates the password to use for database access.

$DBPasswd = 'mypassword1';

wouldn't that allow someone to read the password value? Am I reading the instructions correctly, in that i should replace

'mypassword1' with the password I intend to use for administration?

Kenneth M. Dunning


Just figured out the "LOCK TABLES wiki_rate WRITE" problem. It seems that the RickVanLieshout/InitDatabasePHPScript contains some WikiWords in the code. They are undefined, so they get a question mark tacked onto them. When you copy and paste the code, the question marks make some of the code not work as intended. It doesn't throw any errors, but it also does not create the tables you need! Then when you try to run the wiki it can't find the tables that should've been created.

Resolution: When you download RickVanLieshout/InitDatabasePHPScript, make sure you copy and paste from the "edit document" screen, rather than the normal screen. That way you'll get clean source code and the script will be able to create the tables you need.


I downloaded the RickVanLieshout/InitDatabasePHPScript from the "edit document" screen, but I'm getting the "LOCK TABLES wiki_rate WRITE" error anyway. Any other ideas?


I get "LOCK TABLES rate WRITE" error too. I used InitDatabasePHPScript? to create database. I tried to make tables with prefixes, but error is still here, but now its "LOCK TABLES wiki_rate WRITE". I checked mywiki.php and config.php scripts - no question marks there except <?php> tags. Surely its not a question of permission - my user have all possible rights.

I think its a bug. Can some php developer say something?

My software: tavi 0.25, php 4.3.4, apache 1.3.12, mysql 4.0.9.


Try restarting MySql (# /etc/init.d/mysql restart) or reload the privileges table (mysql> FLUSH PRIVILEGES) - This cured it for me...

Philip Fletcher


Reloaded. Now it says "LIB_ErrorDatabaseSelect?".

Problem is in file lib/db.php, line 20:

mysql_select_db($database, $this->handle) == false

---

I found the problem:

The User you entered in the config.php doesn't have the previleges to execute the LOCK "table" WRITE command. Maybe i can find a workaround. Stay stuned.

Edit: It's me again. You have to set the "Lock_Tables_Priv" true for the database you use for the wiki. If you have hosted space then you have to ask your hoster.