DokuWIKI search not working or updating
I installed a DokuWIKI with https on Ubuntu 14. It’s pretty straight forward however I rand into a small issue where search wasn’t yielding any results.
To fix this I found this article about using the indexer.php file from the command line.
https://www.dokuwiki.org/cli
What you do then is:
cd /var/www/bin… <- where your dokuwiki is installed, mine was installed in the root of www but most of the time you’ll find it in a /var/www/doku folder I think
chmod +x indexer.php
This makes the script executable. You can test it to see if it works by typing cd .. > ./bin/indexer.php. You should see it index. Now your search works. So what we now need to do is schedule that script to run. It’s supposed to run with some pixel and when you update a page but for me, that’s not working and I don’t have time to figure that out so this is the quickest fix I can live with.
I usually make a folder in /var called ftp and put my notes, scripts and downloads into that folder…it’s an old habit. You can put your script wherever you want, change the paths accordingly.
Create a script that we can put into a cron.
I usually do this to create the file:
touch /var/ftp/indexer.sh
nano /var/ftp/indexer.sh
Paste the below script contents into that file:
#!/bin/sh
cd /var/www/bin
./indexer.php
Save it.
Then type: crontab -u www-data -e
* This is on Ubuntu anyway, you need to run the script as www-data or else it seems perms to the files get changed to “root” and it messes up the ability to save the meta information (wiki changes). Reference: StackOverflow http://stackoverflow.com/questions/8475694/how-to-specify-in-crontab-by-what-user-to-run-script
Choose 2 > nano as your editor, it is the easiest editor in the list.
For our crontab put this in to run the indexer every 4 hours:
0 1,4,8,12,16,20 * * * sh /var/ftp/index.sh
Mind the space between the zero and the 1. The zero means to kick it off at 1:00 for example, 4:00…if I had a 5 in there it would be 1:05 or 4:05.