WackoWiki R4.2 with PHP 5.6

Objective: run WackoWiki R4.2 on PHP 5.6.37, MySQL 5.7 and modern Apache or nginx.


Specifications:

  1. PHP 5.6.37
  2. MySQL 5.7
  3. Modern Apache or nginx (assumed version insensitive)
  4. WackoWiki R4.2

We'll describe here the default WackoWiki R4.2 distro setup, but in your case you may have a website based on WackoWiki R4.2 installed on or backed up from a web server with previous version of PHP where it worked well. We assume that you all know how to back up and move existing website form one web server to another.


We'll focus this manual on how to solve some problems emerging when migrating to PHP 5.6.37 and MySQL 5.7. This is sometimes done automatically by hosting company or can be done manually by switching the PHP Version in hosting control panel. In most cases this does not require moving existing website form one web server to another.


So let's begin step by step from installation of WackoWiki R4.2.
Warning: WackoWiki R4.2 is outdated and you should use recent version for fresh install


1. When starting installation you'll see:


Deprecated: Function set_magic_quotes_runtime() is deprecated in /wakka.php on line 35


To fix this and many other Deprecated errors you must edit line 6 of /wakka.php to change

error_reporting (E_ALL ^ E_NOTICE);

to

error_reporting (E_ALL & ~E_NOTICE & ~E_DEPRECATED);

2. The tables won't be created so easily. When upgrading to MySQL 5.5 or later, you must convert existing applications that rely on TYPE to use ENGINE instead. So you must edit /setup/install.php change all occurrences of

TYPE=MyISAM

to

ENGINE=MyISAM

BTW, you may debug your queries adding

echo mysql_errno($dblink) . ": " . mysql_error($dblink). "\n";

just after a query to print MySQL error code and description if something goes wrong.


In line 131 of /setup/install.php change


        "time timestamp(14) NOT NULL, ".

to 

        "time timestamp(6) NOT NULL, ".

Now it will install well.


3. Going to the website will show you


Catchable fatal error: Object of class Wacko could not be converted to string in /wakka.php on line 254


to solve it just comment out line 254 in /wakka.php, change it to

//$cache->Log("Before Run wacko=".$wacko);

save and refresh the page.


4. You'll see a page now but a new Warning will appear


Warning: Illegal string offset 'stripnotypo' in /formatters/post_wacko.php on line 10


To fix this change lines 10 and 13 in /formatters/post_wacko.php from

if ($options["stripnotypo"]) {
  $text = str_replace("<!--notypo-->", "", $text);
  $text = str_replace("<!--/notypo-->", "", $text);
    }

to

//if ($options["stripnotypo"]) {
  $text = str_replace("<!--notypo-->", "", $text);
  $text = str_replace("<!--/notypo-->", "", $text);
//    }

And after that your WackoWiki R4.2 will let you add and edit pages and comments, upload and delete file, change ACLs and settings. But you should not log out with Logout link.


5. If you press Logout you'll see:


Warning: Illegal string offset 'lang' in /classes/wacko.php on line 2088


Warning: Illegal string offset 'name' in /classes/wacko.php on line 511


Warning: Illegal string offset 'lang' in /classes/wacko.php on line 514


Warning: Illegal string offset 'bookmarks' in /classes/wacko.php on line 514


Warning: Illegal string offset 'lang' in /classes/wacko.php on line 514


First we go to /classes/wacko.php line 2088 and change it from

   $this->userlang = ($user["lang"]?$user["lang"]:$this->GetConfigValue("language"));

to

   $this->userlang = (isset($user["lang"])?$user["lang"]:$this->GetConfigValue("language"));

Then we go to /classes/wacko.php line 511-514 and change them from

  $pages[$cl] = $user["name"]; 


  $bookm = $this->GetDefaultBookmarks($user["lang"], "site")."\n".($user["bookmarks"] ? $user["bookmarks"] : $this->GetDefaultBookmarks($user["lang"]));

to

  $pages[$cl] = (isset($user["name"])? $user["name"] : null); 

  if(!isset($user["lang"])) $user["lang"] = null;
  $bookm = $this->GetDefaultBookmarks($user["lang"], "site")."\n".(isset($user["bookmarks"]) ? $user["bookmarks"] : $this->GetDefaultBookmarks($user["lang"]));

Now you can logout with Logout link.


6. In some cases, especially when you got multilanguage Wiki installation, you may meet some strange text display errors like:

&#1056;&#1077;&#1075;&#1080;&#1089;&#1090;&#1088;&#1072;&#1094;&#1080;&#1103;

this happens when searching something via Search. This error means that your htmlspecialchars encoding is different from your website default encoding.


To fix this for your default language you should edit your php.ini of your webhost an change default_charset there to

default_charset = ""

If you can't access php.ini, you can try to add

ini_set( 'default_charset', "" );

to /wakka.php after line 6.


You can also set manually the default_encoding to match your website encoding.
The list of supported charsets see here in the encoding section.
More information on why this error happens see here.


Now the old WackoWiki R4.2 can work till all web servers move to PHP >= 7.
So the webmasters using WackoWiki R4.2 have some time to upgrade to the most recent version of WackoWiki.