Get PHPwiki up and running with mysql

Ran into some difficulty installing the wiki with mysql backend as the documentation wasn't upto-date.

Below are some notes and customization done during the process:

  1. Download the latest tarball from SourceForge
  2. Extract all files.
  3. Copy 'config/config-dist.ini' to 'config/config.ini' and edit the settings.
  4. Make sure to set the value of 'DEBUG' to either 1 or 0 and do not comment it out. The install process complains if the DEBUG value is not found.
  5. Upload the "passencrypt.php" to the web-server and access it via browser to encrypt password.
  6. Use the encrypted password for the 'ADMIN_PASSWD' field and make sure that 'ENCRYPTED_PASSWD = true' is uncommented.
  7. Use the ADODB library for data access and set 'DATABASE_TYPE = ADODB'.
  8. Use 'DATABASE_PREFIX = phpwiki_' with the EditedMysqlScript imported to the database to create the required tables.
    # ================= BEGIN =================
    # Table structure for table `phpwiki_link`
    #
    
    DROP TABLE IF EXISTS `phpwiki_link`;
    CREATE TABLE `phpwiki_link` (
      `linkfrom` int(11) NOT NULL default '0',
      `linkto` int(11) NOT NULL default '0',
      KEY `linkfrom` (`linkfrom`),
      KEY `linkto` (`linkto`)
    ) TYPE=MyISAM;
    
    #
    # Table structure for table `phpwiki_member`
    #
    
    DROP TABLE IF EXISTS `phpwiki_member`;
    CREATE TABLE `phpwiki_member` (
      `userid` char(48) binary NOT NULL default ,
      `groupname` char(48) binary NOT NULL default 'users',
      KEY `userid` (`userid`),
      KEY `groupname` (`groupname`)
    ) TYPE=MyISAM;
    
    #
    # Table structure for table `phpwiki_nonempty`
    #
    
    DROP TABLE IF EXISTS `phpwiki_nonempty`;
    CREATE TABLE `phpwiki_nonempty` (
      `id` int(11) NOT NULL default '0',
      PRIMARY KEY  (`id`)
    ) TYPE=MyISAM;
    
    #
    # Table structure for table `phpwiki_page`
    #
    
    DROP TABLE IF EXISTS `phpwiki_page`;
    CREATE TABLE `phpwiki_page` (
      `id` int(11) NOT NULL auto_increment,
      `pagename` varchar(100) binary NOT NULL default ,
      `hits` int(11) NOT NULL default '0',
      `pagedata` mediumtext NOT NULL,
      PRIMARY KEY  (`id`),
      UNIQUE KEY `pagename` (`pagename`)
    ) TYPE=MyISAM AUTO_INCREMENT=320 ;
    
    #
    # Table structure for table `phpwiki_pref`
    #
    
    DROP TABLE IF EXISTS `phpwiki_pref`;
    CREATE TABLE `phpwiki_pref` (
      `userid` varchar(48) binary NOT NULL default ,
      `prefs` text,
      PRIMARY KEY  (`userid`),
      UNIQUE KEY `userid` (`userid`)
    ) TYPE=MyISAM;
    
    #
    # Table structure for table `phpwiki_rating`
    #
    
    DROP TABLE IF EXISTS `phpwiki_rating`;
    CREATE TABLE `phpwiki_rating` (
      `dimension` int(4) NOT NULL default '0',
      `raterpage` int(11) NOT NULL default '0',
      `rateepage` int(11) NOT NULL default '0',
      `ratingvalue` float NOT NULL default '0',
      `rateeversion` int(11) NOT NULL default '0',
      `tstamp` timestamp(14) NOT NULL,
      PRIMARY KEY  (`dimension`,`raterpage`,`rateepage`)
    ) TYPE=MyISAM;
    
    #
    # Table structure for table `phpwiki_recent`
    #
    
    DROP TABLE IF EXISTS `phpwiki_recent`;
    CREATE TABLE `phpwiki_recent` (
      `id` int(11) NOT NULL default '0',
      `latestversion` int(11) default NULL,
      `latestmajor` int(11) default NULL,
      `latestminor` int(11) default NULL,
      PRIMARY KEY  (`id`)
    ) TYPE=MyISAM;
    
    #
    # Table structure for table `phpwiki_session`
    #
    
    DROP TABLE IF EXISTS `phpwiki_session`;
    CREATE TABLE `phpwiki_session` (
      `sess_id` varchar(32) NOT NULL default ,
      `sess_data` blob NOT NULL,
      `sess_date` int(10) unsigned NOT NULL default '0',
      `sess_ip` varchar(15) NOT NULL default ,
      PRIMARY KEY  (`sess_id`),
      KEY `sess_date` (`sess_date`)
    ) TYPE=MyISAM;
    
    #
    # Table structure for table `phpwiki_user`
    #
    
    DROP TABLE IF EXISTS `phpwiki_user`;
    CREATE TABLE `phpwiki_user` (
      `userid` char(48) binary NOT NULL default ,
      `passwd` char(48) binary default '',
      PRIMARY KEY  (`userid`),
      UNIQUE KEY `userid` (`userid`)
    ) TYPE=MyISAM;
    
    #
    # Table structure for table `phpwiki_version`
    #
    
    DROP TABLE IF EXISTS `phpwiki_version`;
    CREATE TABLE `phpwiki_version` (
      `id` int(11) NOT NULL default '0',
      `version` int(11) NOT NULL default '0',
      `mtime` int(11) NOT NULL default '0',
      `minor_edit` tinyint(4) default '0',
      `content` mediumtext NOT NULL,
      `versiondata` mediumtext NOT NULL,
      PRIMARY KEY  (`id`,`version`),
      KEY `mtime` (`mtime`)
    ) TYPE=MyISAM;
    
    #
    # ================= END =================
    #
    
  9. Specify the Data Source Name, 'mysql://user:password@host/databasename'
  10. For true user authentication use
    • ALLOW_ANON_USER = true
    • ALLOW_ANON_EDIT = false
    • ALLOW_BOGO_LOGIN = false
    • ALLOW_USER_PASSWORDS = true
  11. Other configs are more general and changed accordingly depending on preferences.
  12. Upload all your files to the web-server and pointing your browser for the first time to the index.php will set up your wiki automatically.
Comment