Closed
Description
Spent almost an hour trying to fix non-existent issue. It's was silly of me, but vips was keeping to throw "Unable to find library" exception and it's confusing. In the end issue was with ffi.enabled=off
, of course :(
(In my defense: debugging on a remote server with a different OS isn't so easy, and its php-fpm, and the project's exception handler clears stdout and I only see exceptions from vips in the project log)
Wanted to make a small PR, but not sure how to fix this better. One idea so far - to simple check for string ffi.enable
in exception message (https://github.com/libvips/php-vips/blob/master/src/FFI.php#L252):
$lastException = null;
foreach ($libraryPaths as $path) {
try {
...
} catch (\FFI\Exception $e) {
$lastException = $e;
Utils::debugLog("init", ["msg" => "library load failed", "exception" => $e]);
}
}
if ($vips === null) {
if ($lastException && strpos($lastException->getMessage(), "ffi.enable") !== false) {
throw new Exception("Please, check your FFI configuration", 0, $lastException);
}
...
}
Or may be without message and just re-throw $lastException?
Metadata
Metadata
Assignees
Labels
No labels