php-vips: FFI\Exception : Failed loading 'libvips.so.42' after upgrade to v2
Hello,
I’ve just upgraded a PHP 8.1 app from v1 to v2 and am now getting the following exception:
FFI\Exception : Failed loading 'libvips.so.42'
.../vendor/jcupitt/vips/src/Config.php:310
.../vendor/jcupitt/vips/src/Config.php:195
.../vendor/jcupitt/vips/src/Config.php:259
.../vendor/jcupitt/vips/src/Image.php:712
I’ve enabled FFI like so:
FFI support => enabled
Directive => Local Value => Master Value
ffi.enable => On => On
ffi.preload => no value => no value
I also removed the vips php extension, libvips is on version 8.12.2 and was installed via Homebrew.
I’d appreciate any pointers when you find some time. Thanks!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 28 (14 by maintainers)
Commits related to this issue
- fix libname on macos The OS name was not right for macOS. Released as 2.0.1. Thanks andrefelipe. See https://github.com/libvips/php-vips/issues/140 — committed to libvips/php-vips by jcupitt 2 years ago
- Ensure libvips can be found on Apple Silicon Allow users to set the `VIPSHOME` env when libvips is installed in a non-standard path. On macOS, always search in `/opt/homebrew/lib/` as a fallback. In... — committed to kleisauke/php-vips by kleisauke 2 years ago
- Move FFI functions to a separate class (#147) * Move FFI functions to a separate class * Ensure libvips can be found on Apple Silicon Allow users to set the `VIPSHOME` env when libvips is insta... — committed to libvips/php-vips by kleisauke 2 years ago
@andrefelipe oh sweet! That’s a good find! I’ll patch it. Sorry, I should have spotted that the libname was wrong.
Yes, direct loading of the library should be MUCH better than that binary extension. I’m hoping it’ll save a lot of people a lot of trouble.
Found it!!!
PHP_OS_FAMILY constant is “Darwin” in my case (not sure about “OSX”)
So at “Config.php” file I changed the libraryName function to be:
It should just work with current php-vips. I bought an M2 mac mini and pasted some extra code in. With homebrew libvips, no config should be necessary.