I don't know anything about DokuWiki, but I can give you some hints with permissions.
DokuWiki is a PHP application thus running in a web server.
This web server can be Apache, Lighttpd, ngingx and maybe another one.
The webserver doesn't run as root. It runs either as the "nobody" user or on Debian servers for example the user is "www-data". It can also be "apache".
Ubuntu and Debian use www-data as I said.
You can also figure out the permissions in /var/www.
Just "cd" to this directory, then type "ls -l" at prompt, and it will give you the list of files with the owner and the group. (there's a www-data group as well).
Now that you know which system user the web server runs as, try that:
Go to your mediawiki installation directory :
Set permissions to the webserver user / group :
chown www-data:www-data . -R
(-R means "recursive" => all files and subfolders)
chmod 775 . -R
Then the webserver user and members of the group can read, write and execute files.
As you were wondering for security, the permissions should not be 775 but weaker on most of the files except for some directories like "upload" or "temp" ones that could even be 777. But again, I don't know about mediawiki