Topic: Trouble installing PunBB - Unable to create table posts

Hi,

I'm trying to install PunBB on WinXP, MYSQL, APACHE 2.0. So far I followed every instruction with succes but now I'm stuck. I get the following error message when I try to install with upload/install.php.

****
An error occured on line 805 in file D:\WEBSERVER\Apache2\htdocs\forum\upload\install.php.
PunBB reported: Unable to create table posts. Please check your settings and try again.
Database reported: BLOB/TEXT column 'message' can't have a default value (Errno: 1101)
****

I double checked everything twice. Some tables are made in MYSQL when I check so PunBB can reach the DB.
Can anyone help?

Orange

Re: Trouble installing PunBB - Unable to create table posts

Moved to Bugs

I was able to find a MySQL bug linked to this:
http://bugs.mysql.com/bug.php?id=19498

[4 Aug 5:53] Paul DuBois

Noted in 5.0.25 changelog.

TEXT and BLOB columns do not support DEFAULT values. However, when a
default of '' was specified, the specification was silently ignored.
This now results in a warning, or an error in strict mode.

So in newer versions of MySQL in strict mode, PunBB's install will fail. The fix is simply to do "message text," since having a default appears to do nothing anyway.

Orange: If you would like a fix, do this to install.php
FIND

                        $sql = 'CREATE TABLE '.$db_prefix."posts (
                                        id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                                        poster VARCHAR(200) NOT NULL DEFAULT '',
                                        poster_id INT(10) UNSIGNED NOT NULL DEFAULT 1,
                                        poster_ip VARCHAR(15),
                                        poster_email VARCHAR(50),
                                        message TEXT NOT NULL DEFAULT '',
                                        hide_smilies TINYINT(1) NOT NULL DEFAULT 0,
                                        posted INT(10) UNSIGNED NOT NULL DEFAULT 0,
                                        edited INT(10) UNSIGNED,
                                        edited_by VARCHAR(200),
                                        topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
                                        PRIMARY KEY (id)
                                        ) TYPE=MyISAM;";

REPLACE WITH

                        $sql = 'CREATE TABLE '.$db_prefix."posts (
                                        id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                                        poster VARCHAR(200) NOT NULL DEFAULT '',
                                        poster_id INT(10) UNSIGNED NOT NULL DEFAULT 1,
                                        poster_ip VARCHAR(15),
                                        poster_email VARCHAR(50),
                                        message TEXT,
                                        hide_smilies TINYINT(1) NOT NULL DEFAULT 0,
                                        posted INT(10) UNSIGNED NOT NULL DEFAULT 0,
                                        edited INT(10) UNSIGNED,
                                        edited_by VARCHAR(200),
                                        topic_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
                                        PRIMARY KEY (id)
                                        ) TYPE=MyISAM;";

Re: Trouble installing PunBB - Unable to create table posts

You have to do the same in the tables search_cache and reports. Search install.php for "TEXT NOT NULL DEFAULT ''" and delete everything between TEXT and the comma at the end of the line.

Edit: The fix. I changed the queries for sqlite and pgsql as well (for consistency).

"Programming is like sex: one mistake and you have to support it for the rest of your life."