php
and php-gd
packages should have been installed by the dokuwiki
package as dependencies. Manual installation should not be necessary.To install DokuWiki using the OpenBSD packages use the package manager:
~$ doas pkg_add dokuwiki
The package manager will take care of setting up dependencies and chroot requirements.
Note: The package dokuwiki-2020.07.29p0
requires users wanting to install templates using the Extension Manager to change the owner of /var/www/dokuwiki/lib/tpl
to www
:
# chown www /var/www/dokuwiki/lib/tpl
The package doesn't do all of this so you should also look at this if you run into problems.
First install PHP and a dependency if required1):
~$ doas pkg_add php php-gd
You should be able to choose the newest version of PHP. We will use 7.4 for this example.
To enable the installed PHP package add the symbolic links as root:
# cd /etc/php-7.4.sample # for i in *; do ln -sf ../php-7.4.sample/$i ../php-7.4/; done
Start up the PHP FPM daemon:
~$ doas rcctl start php74_fpm
Old method
Add the daemon to the list of things started up at boot in the /etc/rc.conf.local file (you might have to create it) by adding it to any existing list like this:
pkg_scripts=pkg1 pkg2 php74_fpm
New method:
~$ doas rcctl enable php74_fpm
Once you have PHP working you can go through the generic installation instructions. Pay particular attention to setting up the permissions properly. If you are using the OpenBSD httpd web server you will be setting things to a user of www and group of www.
You may want to change your httpd.conf to something similar show below.
server "default" { listen on egress port 80 listen on 127.0.0.1 port 80 location "/dokuwiki/*.php*" { root "/dokuwiki" request strip 1 fastcgi socket "/run/php-fpm.sock" } location "/dokuwiki/*" { directory index index.php root "/dokuwiki" request strip 1 } }
Alternative configuration with updated syntax (tested on OpenBSD 6.6):
server "default" { listen on egress port 443 root "/dokuwiki" directory index doku.php # Set according to upload_max_filesize and post_max_size in php.ini connection max request body 20971520 location "*.php" { fastcgi socket "/run/php-fpm.sock" } location "/data/*" { block } location "/conf/*" { block } location "/bin/*" { block } location "/inc/*" { block } location "/vendor/*" { block } }
Don't forget to check your configuration using httpd -n
! If all is well you can start httpd(8) using:
~$ doas rcctl start httpd
To enable httpd(8) at boot time use:
~$ doas rcctl enable httpd
And for completeness, after changing your httpd.conf use:
~$ doas httpd -n ~$ doas rcctl reload httpd
or
~$ doas httpd -n ~$ doas rcctl restart httpd
The OpenBSD web server chroot is fairly restrictive by default. If you want to use things like automatic extension downloading you will need to open things up a bit. This should allow outgoing http and https connections. As root (creating any needed directories on the way):
# mkdir /var/www/dev # mknod /var/www/dev/urandom c 45 2 # mkdir /var/www/etc # cp /etc/resolv.conf /var/www/etc/ # cp /etc/hosts /var/www/etc/ # cp /etc/services /var/www/etc/ # mkdir /var/www/etc/ssl # cp /etc/ssl/cert.pem /var/www/etc/ssl/
Note: On OpenBSD 6.9 using the package dokuwiki-2020.07.29p0
the above did not seem to be sufficient to allow DokuWiki access to the plugin and template repositories. The Extension Manager still displayed the message: “The plugin repository could not be contacted. Make sure your server is allowed to contact www.dokuwiki.org and check your proxy settings. [Retry]”.
Solution: Restart the PHP FPM service:
~$ doas rcctl restart php74_fpm
php
and php-gd
packages should have been installed by the dokuwiki
package as dependencies. Manual installation should not be necessary.