From 53d7057cd845d8fc762b9eb68164c46a4aa4c1e1 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 26 Feb 2026 09:36:00 +0000 Subject: [PATCH 1/3] better ffi startup diagnostics --- CHANGELOG.md | 4 ++++ src/FFI.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb0e913..e31e17e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `php-vips` will be documented in this file. +## master + +- better ffi startup diagnostics [ping-localhost] + ## 2.6.1 - 2025-12-10 - suppress autodoc of `composite` and `DemandStyle` [jcupitt] diff --git a/src/FFI.php b/src/FFI.php index 722065d..83558ca 100644 --- a/src/FFI.php +++ b/src/FFI.php @@ -281,7 +281,7 @@ private static function init(): void if (!extension_loaded('ffi')) { throw new Exception('FFI extension not loaded'); } - if (!ini_get('ffi.enable')) { + if (ini_get('ffi.enable') != 'true') { throw new Exception("ffi.enable not set to 'true'"); } From e7471072a5bcd8fe4286cdc5894c5276803cf8a7 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 26 Feb 2026 09:40:19 +0000 Subject: [PATCH 2/3] better message --- src/FFI.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/FFI.php b/src/FFI.php index 83558ca..abc399b 100644 --- a/src/FFI.php +++ b/src/FFI.php @@ -278,11 +278,12 @@ private static function init(): void } // detect the most common installation problems - if (!extension_loaded('ffi')) { - throw new Exception('FFI extension not loaded'); + if (!extension_loaded("ffi")) { + throw new Exception("FFI extension not loaded"); } - if (ini_get('ffi.enable') != 'true') { - throw new Exception("ffi.enable not set to 'true'"); + $enable = ini_get("ffi.enable"); + if ($enable != "true") { + throw new Exception("ffi.enable set to '$enable', not 'true'"); } $vips_libname = self::libraryName("libvips", 42); From 0aa6d8a1726af21912e2ff9dfe871248d7e6eeb7 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 26 Feb 2026 09:42:51 +0000 Subject: [PATCH 3/3] allow 1 as well --- src/FFI.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FFI.php b/src/FFI.php index abc399b..70b948c 100644 --- a/src/FFI.php +++ b/src/FFI.php @@ -282,7 +282,8 @@ private static function init(): void throw new Exception("FFI extension not loaded"); } $enable = ini_get("ffi.enable"); - if ($enable != "true") { + if ($enable != "true" && + $enable != "1") { throw new Exception("ffi.enable set to '$enable', not 'true'"); }