This is an old revision of the document!
Table of Contents
4get on OpenBSD
dependencies
git
git is needed to clone the source repositories of php-apcu and 4get.
doas pkg_add git
php
simply install the php package. you probably want to select the latest (last listed) version when it prompts you. this will also provide php-fpm.
doas pkg_add php
this guide will assume 8.2 as the php version. do not just copy the given commands; adjust them as needed.
4get's php module dependencies include mbstring, imagemagick, apcu, and curl.
mbstring
php-mbstring is built into the php binaries distributed by OpenBSD.
imagemagick
imagemagick, the library itself, is provided by the package ImageMagick. note that imagemagick requires libraries provided by the xbase root tarball. if you did not select it during the installation process of OpenBSD, you can download it from a mirror and extract it.
the php module is provided by the pecl*-imagick package. install it for your php version.
pkg_add pecl82-imagick
curl
php-curl is provided by the php-curl package. install the latest available for your php version.
pkg_add php-curl-8.2.27
apcu
apcu is not provided in ports system or built into php, so you must either install it through pecl or compile it yourself. pecl doesn't seem to work properly and can't see apcu's required libraries (and I don't know how to make it work), so I will show to manually compile it.
as a non-root user, run the following commands.
doas pkg_add autoconf pcre2
you will be asked to make a selection as to the version of autoconf to install. select the latest version (the last on the list). as of now, the latest version is autoconf-2.72p0. the version of autoconf installed is information you will need later.
git clone https://github.com/krakjoe/apcu cd apcu
now run phpize. it is provided by php. put your own autoconf version in place of 2.72.
AUTOCONF_VERSION=2.72 phpize
now run the just-now generated ./configure script.
./configure
there will be a lot of output, but the last line should say “creating config.h”.
installed earlier, pcre2.h is required by apcu, but the compiler can't find it, so we will just copy it to the source directory. (if you know how to do it properly please edit the article).
cp /usr/local/include/pcre2.h ./
now we compile and install it.
make doas make install
to enable the module in php, we must modify the php configuration.
either modify /etc/php-8.2.ini directly, OR create /etc/php-8.2/apcu.ini.
- /etc/php-8.2.ini
... ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; extension=apcu ...
- /etc/php-8.2/apcu.ini
extension=apcu
make sure php is still working properly by running it.
php
if you get no errors everything is probably in working order.