Dokuwiki - Dev environment Configuration and Installation

About

This is the installation and configuration of the dokuwiki development platform on Windows that we use.

No container anymore

We are not working with WSL or any docker anymore because it causes too much pain for little improvement. ie:

  • slow. Docker with the last WSL2 is really, really slow if you don't work in WSL
  • two environment to manage:
    • two composer,
    • two different EOL
  • file permission problem between linux and windows
  • difficult to set up (IDEA does not support entirely WSL, phpunit does not recognize map drive, …)
  • network problem between the virtual container and windows

This is a sort of keep it simple by staying with the smallest tech stack as possible.

Steps

Install php

The PHP version is the lowest supported by Dokuwiki which is 5.6 (See splitbrain/dokuwiki/blob/stable/.travis.yml) This is also the lowest version supported by webhosting provider such as OVH.

For the version 5.6:

php.exe -i > phpinfo.txt

PATH Environment variable

Add in the PATH the php directory

Optional

Extension

  • Change the php.ini configuration (add it at the end)
; some compilation needs the whole path for the extension dir
; extension_dir = "c:/php-5.6.9-Win32-VC11-x64/ext"
[PHP]
extension_dir = "ext"
extension=php_mbstring.dll
extension=php_pdo_sqlite.dll
extension=php_openssl.dll
; for image
extension=php_gd2.dll 

XDebug

  • Download the Xdebug. For php 5.6 NTS: php_xdebug-2.5.5-5.6-vc11-nts-x86_64.dll
[Xdebug]
zend_extension=C:\php-5.6.9-nts-Win32-VC11-x64\ext\php_xdebug-2.5.5-5.6-vc11-nts-x86_64.dll
xdebug.remote_enable=1
xdebug.remote_port=9000

Phpunit

cd yourProject
wget -O phpunit.phar https://phar.phpunit.de/phpunit-5.phar

Package Manager

optional

Install

Install Apache

Apache installation, virtual host and php configuration

Create the virtual host to the dokuwiki root.

Example:

<VirtualHost *:80>
    DocumentRoot "d:/dokuwiki"
    ServerName doku
	DirectoryIndex index.php
    ErrorLog "logs/doku.com-error.log"
    CustomLog "logs/doku.com-access.log" common
	<Directory "d:/dokuwiki/" >
		Require all granted
		AllowOverride All
		Options Indexes FollowSymLinks Includes ExecCGI
	</Directory>
</VirtualHost>

Dokuwiki

Clone Dokuwiki

You need to clone it in order to get the dokuwiki test class.

git clone git://github.com/splitbrain/dokuwiki.git .

Configuration

Go to: http://VitrualHost/install.php to configure it

  • Enable ACL - Yes - to test logged in and logged out
  • ACL Policy: Public

Go to the configuration manager:

  • debug your code with compress disabled. You can verify your code still works with compress enabled with the JSLint online service
  • Cache: Disable the whole render cache by setting the cache page time to -1. See Dokuwiki - Cache Dev configuration
  • Verify that the index.php doesn't have a redirection.
  • Don't set the basurl to be able to test with ngrok. (ie google metadata checking tool does not allow localhost)

Install Stale

Install Stale to stale the cache easily.

Because we are the authors, we clone it.

cd $DOKUWIKI\lib\plugins
git clone https://github.com/ComboStrap/stale

IDEA

See also the dokuwiki documentation

Interpreter

Set the php interpreter

Unit test

To run individual test file on plugin:

  • add the configuration file

  • set the _test directory as Test Source. Context menu option Mark directory As Test Source Root
  • A class/method: add the option –stderr to the test runner options to avoid PHPUnit_Framework_Error_Warning : Cannot modify header information - headers already sent by (output started at …php\pear\PHPUnit\Util\Printer.php:172)

  • Change the running template

Library

Add Jquery as library:

  • Settings (CTRL + ALT + S) > Languages & Frameworks > JavaScript > Libraries (Enabled or Download Jquery)

Browser

  • Chrome: Disable the cache

Support

Call to undefined function dokuwiki\Utf8\mb_strtolower()

Enable the mbstring extension in your php.ini

extension=mbstring

Powered by ComboStrap