I have found out that FFI::scope only works with Apache when you select Apache's threading model "prefork". Using any other threading model results in "scope not found" (and you have to use FFI::load instead because preloading seems not to be possible in this case).