PDF Thumbnails / Ghostscript / PHP 8

The current version of the PECL Imagick extension (3.4.4) is not compatible with PHP 8. If you want to use it, you’ll need to revert to PHP 7.4. The source code in the extension’s GitHub repository is compatible with PHP 8, but it must be compiled.

Thread Starter


@diondesigns: That is true, but only in part.

Thank you for you answer. There is an (unofficial) compiled DLL version available that works very well with PHP 8. The problem with this DLL and according to my research also with other official versions is that it reports @PACKAGE_VERSION@ as version instead of a valid version number. The problem seems not to be windows exclusive, I also read about similar problems on MacOS.

I don’t have a clear idea yet which versions are faulty but it seems to affect several.

While the problem originates obviously from PELC one might also argue that the check for a version greater than ‘2.2.0’ in the WP_Image_Editor_Imagick calss is less than optimal. We learned the hard way in years of browser sniffing that checking for feature is almost ever the better way tp go.

So I would propose to that reworking the WP_Image_Editor_Imagick::test method could use a better approach after about nine years.

I edited the following lines in the php_imagick.h file to change the version:

#define PHP_IMAGICK_VERSION    "8.0.0"
#define PHP_IMAGICK_EXTNUM     80000

After compiling, phpinfo() and phpversion('imagick') both correctly report the Imagick version as 8.0.0. Perhaps the person who built the “unofficial” DLL didn’t do it correctly? That’s a distinct possibility since the build files are for automake/configure and not for cmake.

Also note that the current source contains a fix for the MacOS/homebrew issue.

In any case, since you want to test GhostScript, the best solution for now is to revert to PHP 7.4.

Thread Starter


@diondesigns thanks for your info.

Reverting to PHP 7.4 is not an option for me right now. Also I won’t get into compiling my own DLL soon.

I’m an architect by education and I started programming at 13 – nearly 40 years ago. My business nowadays is mainly designing, building and maintaining websites and related projects. Also I’m a father of three and I shouldn’t take the time to writ such a long comment, but I somehow feel like it right now.
So I do consulting, designing (including a little photography and video-production now and than) I program PHP work with basic SQL, do typescript and teach CSS… and mange to stay up to date with all things web more or less successfully since 1995.
Nothing spectacular, but all in all enough challenge for my elderly brain.
For several reasons my main machine is a windows box (need one to see what most of my users see). I also have a MacBook Pro, iPads, an iPhone and some older android devices for testing. I tried to have a Linux-box around for some time some years ago, but it just added to my workload of keeping too much devices up to date instead of getting some work done.
Until the early days of WordPress I used IIS for local development but at some point I had to switch to Apache (.htaccess) so I decided to go with XAMPP.

Over time I had to make my computer accessible for my clients from outside with dyndns (balancing security against comfort etc.) and also make XAMPP work with letsencrypt, running different PHP versions for different projects etc.

Problem with XAMPP is, that there are no up- or downgrades, if you want a new PHP version you have to do a new install and migrate all your old individual tweaks. As I do that only once in maybe 9 to 10 month automating that isn’t really worth it, also I’m still considering changing the system at some point to a better all around solution which I haven’t found yet.

I was really looking forward to PHP 8 as I’m a great fan of strong typing since AS3 (yes I know…) and have already written several classes that way. So going back to 7.4 would break that. PHP 8 is stable for quite a while now and I’ll stay with it, as at some point I have to anyhow also I like it. Running ImageMagick and ghostscript on my own XAMPP is a benefit for my but not a necessity and I’m ok with the way it works for me right now.
For me and probably for a lot of other people out there ‘perfect’ or even ‘right’ is sometimes not an option, ‘it works’ has to do more often than not.

I somehow envy you for being able to do what you do, and I very much appreciate what you and other geniuses do for the community with your work. And I feel sorry when I use it in a ‘bad’ way but I have to contradict your last statement: For me the best solution for now is to run with my setting and comment out two (obsolete) lines in WP_Image_Editor_Imagick::test

I wrote all this not only to bore you to death, but in the hopes that maybe some like minded spirits might read that and we could exchange experiences. Have a good day all of you.

Source link