This is the installation and configuration of the dokuwiki development platform on Windows that we use.
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.
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:
- Install the X86 version of Visual C++ Redistributable for Visual Studio 2012 (even on a X64 computer)
- Download php 5.6 and unzip it under the root. Example: C:\php-7.2.28-Win32-VC15-x64
- Copy the php-developement.ini to php.ini
- Test it
php.exe -i > phpinfo.txt
PATH Environment variable
Add in the PATH the php directory
- 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:
and with apache via a phpinfo web page:
This section is a summary of the article Xdebug for php 7.2
To enable Xdebug on a dokuwiki devel computer:
[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
- Install phpunit in the project to have coding assistance as stated here
cd yourProject wget -O phpunit.phar https://phar.phpunit.de/phpunit-7.phar
- pear (7.5.9)
Apache installation, virtual host and php configuration
Create the virtual host to the dokuwiki root.
<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>
You need to clone it in order to get the dokuwiki test class.
git clone git://github.com/splitbrain/dokuwiki.git .
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 to stale the cache easily.
Because we are the authors, we clone it.
git clone https://github.com/ComboStrap/stale
See also the dokuwiki documentation
Set the php interpreter to 7.1
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
- For Combostrap developer: set the alternative bootstrap file to \plugins\combo\_test\bootstrap.php
Add Jquery as library:
Disable the cache in devtool
Call to undefined function dokuwiki\Utf8\mb_strtolower()
- Enable the mbstring extension in your php.ini
- And if you have the extension_dir setup, try to comment it