Dokuwiki - Dev environment Configuration and Installation

Card Puncher Data Processing

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 7.2 (See splitbrain/dokuwiki/blob/stable/.travis.yml) This is also the lowest version supported by webhosting provider such as OVH.

For the version 7.2:

php.exe -i > phpinfo.txt

PATH Environment variable

Add in the PATH the php directory

Optional

Extension

extension

  • Change the php.ini configuration
; some compilation needs the whole path for the extension dir
; extension_dir = "c:/php-7.2.28-Win32-VC15-x64/ext"
; some compilation (ie apache.dll) does not need the extension dir (ie 7)
; extension_dir = "ext"
[PHP]
; for image
extension=gd2
; for composer
extension=curl
extension=fileinfo
extension=mbstring
extension=pdo_sqlite
; openssl (ie fopen(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP?)
extension=openssl 
; for locale
extension=intl

You can check if they are loaded with:

php -m

and with apache via a phpinfo web page:

Phpinfo Mbstring Enabled

XDebug

This section is a summary of the article Xdebug for php 7.2

To enable Xdebug on a dokuwiki devel computer:

  • Download Xdebug. For php 7.2: php_xdebug-2.9.4-7.2-vc15-x86_64.dll
  • Modify php.ini
[Xdebug]
zend_extension=C:\php-7.2.28-Win32-VC15-x64\ext\php_xdebug-2.9.4-7.2-vc15-x86_64.dll
xdebug.remote_enable=1
xdebug.remote_port=9000
# enable profiler
xdebug.profiler_enable = 0;
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "<path to output folder>"
xdebug.profiler_output_name = cachegrind.out.%t-%s

Phpunit

cd yourProject
wget -O phpunit.phar https://phar.phpunit.de/phpunit-7.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 to 7.1

Php Interpreter Idea

Unit test

To run individual test file on plugin:

  • add the configuration file

Dokuwiki Phpunit Idea

  • 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)

Phpunit Idea Stderr

  • Change the running template

Phpunit Template Idea

  • For Combostrap developer: set the alternative bootstrap file to \plugins\combo\_test\bootstrap.php

Library

Add Jquery as library:

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

Browser

Disable the cache in devtool

Chrome Disable Cache

Support

Call to undefined function dokuwiki\Utf8\mb_strtolower()

  • Enable the mbstring extension in your php.ini
extension=mbstring
  • And if you have the extension_dir setup, try to comment it
; extension_dir="ext"





Discover More
Card Puncher Data Processing
DokuWiki

is a standards compliant, simple to use Wiki, mainly aimed at creating documentation of any kind. It is targeted at developer teams, workgroups and small companies. It...



Share this page:
Follow us:
Task Runner