-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage troubles under Windows #183
Comments
Hi @West14, Thanks for reporting this. That's odd, I'd expect ffi to find |
I tried here and it seems to work. I downloaded: Then:
What did you download and how did you install it? |
Problems occur when using PHP bindings. The CLI utility works fine and I have no issues with it. |
So therefore I think it must be problem with the way you've installed libvips under php. You must have several different versions of eg. |
I had a read around and I agree, I think the I'll put an I removed that test and it then worked for me. Here's what I did: Install phpI installed this php: https://windows.php.net/downloads/releases/php-8.2.1-Win32-vs16-x64.zip I put it in I made a copy of diff --git a/php.ini-development b/php.ini
index 70c6b00..8c29d74 100644
--- a/php.ini-development
+++ b/php.ini
@@ -920,7 +920,7 @@ default_socket_timeout = 60
;extension=ldap
;extension=curl
-;extension=ffi
+extension=ffi
;extension=ftp
;extension=fileinfo
;extension=gd
@@ -1955,7 +1955,7 @@ ldap.max_links = -1
; "preload" - enabled in CLI scripts and preloaded files (default)
; "false" - always disabled
; "true" - always enabled
-;ffi.enable=preload
+ffi.enable=true
; List of headers files to preload, wildcard patterns allowed.
;ffi.preload= Install libvipsI installed this libvips: Then copied the contents of the
This is a dangerous thing to do -- adding dlls to your main PATH is asking for trouble. I'd find a better way to handle this if I was trying to do this properly. I'll remove these dlls again ASAP. Install php-vipsI downloaded a copy of Then tried php-vips like this:
And it made this: So all working, I think. |
Ah it looks like php-vips 2.1.0 is missing the |
Binding printf() won't work on windows. We should find a better way to test if ffi is enabled. Thanks West14. See #183
I added the platform check to php-vips master.
Yes please, it'd be interesting to see what failed. |
Maybe ini_get and extension_loaded can be used? So we can just do the check like this: extension_loaded('ffi') && strtolower(ini_get('ffi.enable')) == 'true' |
Oh nice! I've added that and credited you. |
Though I see:
Which is curious. |
I'm trying to find out a way how to check it easily. This is how PHP determines if INI value is And, of course, we must not forget about the "preload" option, which is currently not supported as far as I know. |
class_exists('FFI') This can only be used to check if an extension is loaded. The |
I tried the various values with php 8.1. I see:
Sadly it seems the way ini variable values are represented changes quite a bit with the php version :(
Yes, it'd be good to support preload, but no one's done the work yet. |
You can use a simple library to check the availability of FFI: https://github.com/php-ffi/env Or just take the FFI check source code from there. Sorry for the ad =))) |
Oh nice! Thanks for the link @SerafimArts. I don't suppose you know how to detect FFI set to preload? |
$isPreload = ini_get('ffi.enable') === 'preload'; In addition, note that |
I noticed you have:
I think it can also be |
I used to think so too https://github.com/php-ffi/env/blob/1.0.0/src/Runtime.php#L82 However, after testing it, I did not find such behavior. Source: [ffi]
; FFI API restriction. Possible values:
; "preload" - enabled in CLI scripts and preloaded files (default)
; "false" - always disabled
; "true" - always enabled
ffi.enable=true <?php
var_dump(ini_get('ffi.enable')); Actual: E:\Development\php\7.4\php.exe E:\Projects\test\test.php
string(1) "1" E:\Development\php\8.2\php.exe E:\Projects\test\test.php
string(1) "1" PS E:\Projects\test> E:\Development\php\7.4\php.exe -d ffi.enable=true test.php
string(1) "1" And same for 8.1 and 8.2. I think this behavior was changed in some earlier versions (7.3 and below). But if required, I can test for other versions up to 5.6 :D |
west14 was seeing Though I don't know what php version that was. |
Yep, I saw it, but I didn’t manage to reproduce this case even if But... Wait, there is one assumption related to the differences between NTS / TS |
No, there are no differences when running on PHP 7.4.33 TS P.S. Trying to paste set variable by |
P.P.S. However, it is true that the |
It depends on the value in |
Yes indeed. If enclosed in quotation marks, then the Sorry, my comment above (#183 (comment)) was incorrect, did not take this case into account. The correct (given the remark) assertion is the following: $isPreload = !in_array(ini_get('ffi.enable'), ['1', '0', ''], true); |
I have the same problem :( |
This PR tries to improve library finding again, let's move discussion there. |
Hello!
I'm trying to use your library under Windows 10, but there are few problems that I can't figure out how to solve.
printf
function.When I comment it, things start to work.
I also want to ask: what is the latest supported libvips version? When i try 8.14. I get errors like this.
I tried 8.13, but it does not give the expected result (I'll attach reproduce example if needed).
libvips 8.9 seems to be fine.
PHP version:
The text was updated successfully, but these errors were encountered: