If you read
openpty(3) you will find that it needs
/dev/pt* files. If you run the native OpenBSD Apache webserver chrooted it does not have a
/dev/ hierarchy in its chroot location
/var/www.
Maybe you could create a minimal demo script and post it to the OpenBSD misc mailing list and ask for advice.