Posted 23 May 2014 by Brendan Kidwell

Setup a Portable DokuWiki Instance in Windows

DokuWiki is a great wiki engine with minimal requirements that usually gets used to build small public web sites and teams' documentation collections. It's also a good place to keep your personal notes.

This howto will show you the quickest way to get DokuWiki up and running in Windows, with a portable launcher script that should work even if the project's path changes (as it would on a thumbdrive).

In your personal storage space or on your thumbdrive, create a folder called “Notebook” or whatever you want to call it.

Create this Windows batch file in the new folder:

run-dokuwiki.cmd
@echo off
 
set app_root=%~dp0
set PATH=%app_root%\php;%PATH%
 
set ext_path=%app_root%\php\ext
set ini_path=%app_root%\php\php.ini
 
cd /d "%app_root%\dokuwiki"
 
php -c "%ini_path%" -d extension_dir="%ext_path%" -S 127.0.0.1:9003

Download the non-thread-safe version of PHP for Windows from windows.php.net/download/. Extract the Zip file to a new “php” folder under your “Notebook” folder.

Download this php.ini file, extract it from its Zip file, and put it in your “Notebook\php” folder.

Download the stable version of DokuWiki from the DokuWiki downloads page. Extract the dokuwiki folder from that archive to your “Notebook” folder. If the “dokuwiki” folder has a version number in it, rename it to just “dokuwiki”.

Now you should have a “Notebook” folder like this:

Notebook
├── run-dokuwiki.cmd
├── php
│   └── [PHP system]
└── dokuwiki
    └── [DokuWiki installation]

Run run-dokuwiki.cmd. It will start PHP's built-in web server running on port 9003. In your browser, go to http://127.0.0.1:9003/install.php.

Complete the setup wizard with your desired settings. I prefer to set it up as a “closed” wiki requiring me to login, just to be safe.

Your wiki home page is http://127.0.0.1:9003/doku.php.

Here are some more optional things you can do to configure a nice notebook setup:

Go to your Extension Manager page on the Admin screen and install the indexmenu extension.

Go to the the Configuration Settings page on the Admin screen and set the following options:

breadcrumbs = 0
youarehere = true
useheading = Always
userewrite = DokuWiki internal
useslash = true
plugin → indexmenu → skip_index = /(^wiki$|^playground$)/
plugin → indexmenu → skip_file = /(^sidebar$)/

Create a page called “sidebar” in the root namespace with this code in it:

sidebar
{{indexmenu>..#1|js navbar nocookie id#random}}

If you're not sure how to create a page, one way would be to type “sidebar” in the search box, click “Search” and then click the “Create this page” button on the right.

If you're new to DokuWiki, please take the time to read the manual or watch the intro videos.

wim geurden, 2014-05-24 12:06

followed your directions - php does not start; when executing the last line in your cmd file, in a command prompt, ensuring all param are resolved - nothing happens besides a message displaying a php help command

wim geurden, 2014-05-24 12:11

Fixed it - by downloading PHP 5.5 (5.3 did not seem to have the -S params)

Anika, 2014-06-28 07:23

The by far easiest way to set up a portable DokuWiki on Windows is by using the option to include a web server from the official download page. I.e. there already is a built in solution from the official download and you don't even mention it. Have you had any problems with it or did you not know that it exists?

From download.dokuwiki.org:


You may optionally include a minimal Webserver with PHP in your download. This is useful for quickly trying DokuWiki or for running it from an USB stick. This is recommended for personal, single-user use only.

Brendan Kidwell, 2014-07-01 15:23

"Had any problems with it or didn't know it exists?"

I vaguely knew it existed in the past, but I might have had some trouble with it the last time I tried it. My solution doesn't include a web server other than what comes with PHP, so it's smaller. YMMV.

Thanks for pointing it out.

Brendan Kidwell, 2014-07-01 15:28

Ah... The "problem" I had was that Micro Apache project page linked from the DokuWiki on a Stick page seems to have experienced existence failure. I prefer building from supported packages.

Anika, 2014-07-05 08:05

Not including Apache and doing it the way you describe is definitely a valid solution and might be preferred by some people. But you called this solution "the quickest way to get DokuWiki up and running in Windows" which is definitely not true. ;-)

I didn't know this either until today, but the original MicroApache project (which was linked from the "DokuWiki on a stick" page but has now been removed) is not used anymore for that special download from download.dokuwiki.org. It is a custom-built solution which is fairly up-to-date.

Ed, 2015-01-06 07:29

Used the microAppache build and got up and running in minutes on my Win7 64-bit machine.
However, when I moved the stick over to my old XP machine, the browser did not find the wiki, but rather gave me the classic "The page cannot be displayed" message. The command window (where the apache is started from and that waits for a keystroke to close it down) did not show any errors or other unexpected messages.
Is there anything I should do when moving from 64-bit Win7 to (oviously 32_bit) WinXP?

Ed, 2015-01-06 08:17

Little add-on to the previous: I installed the Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) Runtime, otherwise the apache server won't even start. So, that is not the cause of the problem...

Ed, 2015-01-06 08:46

forget my question, unless you experience the same problem.
It was just a matter of "timing".
My XP machine probably had some time settings and was slow (older hardware), so some time-out in the browser kicked in before the wiki was totally up and could reply. I accidently tried a refresh of the browser after a couple of minutes and the wiki appeared.

You could leave a comment if you were logged in.