Gallery1:Installation on OpenBSD - Gallery Codex
Personal tools

Gallery1:Installation on OpenBSD

From Gallery Codex

Gallery 1 and Gallery 2 installations on OpenBSD 3.6

OpenBSD installed from ISO and all packages pulled from

Packages installed included the following and dependencies:


Major problems: Chrooted Apache caused: Problem accessing Mysql Broke NetPBM PHP Sessions

Mysql socket error:

Created /var/www/var/run/mysql and then linked the mysql.socket to there:

ln –f /var/run/mysql/mysql.socket /var/www/var/run/mysql/mysql.socket

Gallery2 on OpenBSD 3.8

  1. Install OpenBSD and get the packages from
  2. Install PHP5 and package p5-GD-1.41p1.tgz (you don't need to fiddle with NetPBM/ImageMagic anymore)
  3. Install MySQL (this creates .sock file automatically)
  4. Copy /bin/sh and /usr/local/bin/zip to corresponding dirs in chrooted environment, along with libs (you can find out what libs you need by doing 'ldd /usr/local/bin/zip')
  5. Configure php.ini file with session.save_path = /tmp
  6. Install gallery and enjoy :)

P.S. If you want to have movies support, you'll need package ffmpeg-20050413.tgz. Install it, copy required libs, and voala!

PHP session problem

The problem was in the php.ini! I checked the http error logs and found the following....

[Wed Apr 27 02:13:41 2005] [error] PHP Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

After a little research I found that I needed to check the php.ini session.save_path and uncomment it. Make sure that the directory exists and is read/write. I just happened to use /tmp which translates to /var/www/tmp outside of the chrooted environment.

session.save_path = /tmp

After that edit, I checked the session diagnostic page and it was keeping track of data.

Fix for NetPBM and JHEAD

The problem laid in that the supporting binaries were not located in the chroot of Apache. I used ldd to find the necessary binaries and copied them into the chroot. Copy over all the binaries that gallery looks for. This was in the diagnostics page of gallery 1 and Gallery2 displayed a listing during the install.

bash-3.00#cp sh /var/www/usr/bin/ ##### I need to check on the exact location #####
bash-3.00# cp jhead /var/www/usr/local/bin/
bash-3.00# ldd jhead
Start End Type Ref Name
00000000 00000000 exe 1 jhead
03663000 2366a000 rlib 1 /usr/lib/
08914000 2894c000 rlib 1 /usr/lib/
0c0ec000 0c0ec000 rtld 1 /usr/libexec/
bash-3.00# cp /usr/lib/ /var/www/usr/lib/
bash-3.00# cp /usr/lib/ /var/www/usr/lib/
bash-3.00# mkdir /var/www/usr/libexec
bash-3.00# cp /usr/libexec/ /var/www/usr/libexec/

On my OBsd 3.6 installation it was necessary to remake the binaries like described in Running gallery2 on OpenBSD by Markus Schatzl.

To make the binaries aware of them, also cp /sbin/ldconfig, do a 'chroot /var/www sh' and update your hints-file with /sbin/ldconfig -m /usr/local/lib