Artificial truth

The more you see, the less you believe.

[archives] [latest] | [homepage] | [atom/rss]

Making snuffleupagus run on Alpine Linux
Sat 12 January 2019 — download

This is a short blogpost about an issue that I faced when I wanted to make Snuffleupagus' testsuite run on Alpine Linux.

No errors during the compilation, but when I tried to run the testsuite the following error appeared:

PHP Warning:  PHP Startup: Unable to load dynamic library 'snuffleupagus.so' (tried: /builds/jvoisin/snuffleupagus/src/modules/snuffleupagus.so (Error relocating /builds/jvoisin/snuffleupagus/src/modules/snuffleupagus.so: ps_globals: symbol not found), /builds/jvoisin/snuffleupagus/src/modules/snuffleupagus.so.so (Error loading shared library /builds/jvoisin/snuffleupagus/src/modules/snuffleupagus.so.so: No such file or directory)) in Unknown on line 0

Five minutes of web searches didn't yield any obvious solution, and instead of looking at php's source code for clues, I lazily asked on Alpine's IRC, where ncopa (thanks!) found that I wasn't the only person with this issue.

A quick glance at php's source code confirmed that php_ps_globals is indeed defined in ext/session/php_session.h, and that sessions support isn't necessarily builtin, but can be disabled entirely (except on Windows, because reasons I guess).

It's interesting to note that installing the php7-session package won't help in this particular case, because there is no way to register a custom function handler when sessions support is added as a module and not as a builtin.

The solution to prevent Snuffleupagus from crashing on Alpine was simply to add a guard #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) around a warning, should the user try to use a session-related feature. There are other issues remaining that are preventing the testsuite from running correctly on Alpine, but those will likely be detailed in an other blogpost ;)