I'm trying to compile the imagick extension for Heroku, but I need it to look in the /app/bin folder for ImageMagick rather than the /usr/bin/ folder. I've used as much google-fu as I have, but I can't figure out how to build the imagick.so extension and have it point to a different folder.
From PHP, if I do shell_exec("which convert") it echoes the /app/bin version, but when I do Imagick::getVersion() it points to the /usr/bin/ version. This makes me think it's an issue in the extension.
I haven't ever had to make my own extension from source, so that could definitely be part of the reason. Anything you could do to point me in the right direction would be helpful.
Try with a php.ini file in the webroot, with the following contents:
extension_dir="/app/bin"
extension=imagick.so
You may have the wrong end of the stick. You don't compile the Imagick extension against the Image Magick executables but against the Image Magick libraries. i.e. if you're installing Image Magick through a package manager, you should be installing "ImageMagick-devel" not "ImageMagick"
You can then set the directory that Imagick should look for the Image Magick libraries for with the setting:
./configure --libdir=/usr/lib64 --with-php-config=/usr/local/bin/php-config
Or similar depending on where the libraries are installed, and then call make.
However if you're already compiling Imagick you might as well as also compile Image Magick from source.
Edit
If I was standing behind you, this would probably be solvable in 5 minutes. I suggest:
1) Find where the Imagick libraries actually are on your system - in particular find the libMagickWand-6.Q16.so file.
2) Make sure you're copying the Image Magick libraries that you want to use to the live server as well as the Imagick library, unless you're statically compiling it (which you probably aren't).
3) Rename the lib that you don't want it to be compiled against. See if compiling Imagick picks the right version up then.
4) Debug the ./configure script for Imagick - you can print stuff out like AC_MSG_RESULT(libs before $DEBUG_LIBS) as I had to do for one issue: https://github.com/mkoppanen/imagick/issues/8 and ensure it's picking the right version up when compiling.
5) Raise an issue at https://github.com/mkoppanen/imagick/ and get the Imagick guy to have a look.
Related
I found tons of instructions, how to install Imagick on windows. Here is a very good and detaild explanation.
I am following the instructions. So, first, download the latest DLL from PECL. Copy the php_imagick.dll to the extension dir, copy the _CORE* libraries to PHP root directory, and it shows me the following version: ImageMagick 6.9.1-2 Q16 x64 2015-04-14
Wow, great, now I have nothing to do just install this exe.
Oh, wait...
There are no installer like this. And the problems starts here. Of course, I've tried to download and install the latest installer, installed it, set the environment variables, but it always says something about entry points.
I don't know why Imagick guys removes the releases from their ftp, I think this is a very bad behaviour. Can not access from archive too.
So I am unable to installing the Imagick.
Can anybody help me with this version of installer, or give me a step-by-step instruction, how to install this Imagick for Windows 10, 64bit for Apache 2.4.2 64bit, and PHP 5.6.5 64bit?
I tried the 32bit version, but with that, the phpinfo() does not show me anything.
EDIT: There is an alternative download location here.
I started a thread on the Imagick forum, and now I don't know, should I cry or should I laugh...
The answer for my question was this:
Hmm... it seems we don't build our libraries with 'deprecated' methods. I will see if we can change this before the next release so DrawAllocateWand will not suddenly be gone.
I tell to the guy, ok, it's a cool thing, but I've just reinstall my machine from the scratch, so, I got this error:
Procedure entry point (DrawAllocateWand) not found in DLL
or something similar, I translated it.
So, please tell me, where can I download the ImageMagick 6.9.1-2 Q16 x64 2015-04-14 binaries, because it seems, that php_imagick.dll need this, and I should work...
The answer was:
We don't keep an archive of old binary version of ImageMagick. You could however decide to build IM from source.
CONCLUSION
If you ever had a working installer for windows for Apache, PHP, Imagick, you should always keep these in the cloud for yourself. MHO: I really hate these things. I know, most of us is working on linux boxes, but our company policy is to use OS what admin says. So I need to use windows. Now I should suck for a while, to download and install a cygwin with compilers, compile the Imagick somehow, and set all the environments variables, because some developers do not use a version controller, or maybe the sotrage is too expensive for them to store old binaries... I can not imagene these options.
ImageMagick is available here:
http://windows.php.net/downloads/pecl/deps/
Imagick, that has been compiled against that version of ImageMagick is available here
http://windows.php.net/downloads/pecl/releases/imagick/3.4.0rc5/
Downloading random versions of libraries from other places is not guaranteed to work.
I have been struggling with installing the ImageMagick module to my XAMPP installation for my Typo3 application. The PHP is 5.4.19, x86, MSVC9. I have tried different versions of IM and IM module, always with different errors on Apache startup including
%1 is not a valid win32 application
php5.dll is missing
The procedure entry point MagickGetImageMatte could not be located in the dynamic CORE_RL_wan_.dll
The last of the errors was with the PHP 5.4 thread safe x86 module and the ImageMagick-6.8.8-7-Q16-x86-dll.exe ImageMagick installation. I then tried to copy the CORE dlls, which the module archive contained, into the ImageMagick folder (replacing the original ones). The error went away, the Apache starts without any errors, the imagick module finally appears in phpinfo, however it says
ImageMagick number of supported formats: 0
ImageMagick supported formats no value
and in Typo3 the associated functionalities suggest it still is not working properly. What can be done to make it work?
If I was you, I wouldn't try to use the ImageMagick PHP module any more.
This is not really necessary.
I am not even sure if TYPO3 can handle this module at all since I never tried it.
Since many years I just point the TYPO3 to the binary folder of ImageMagick where all the tools (convert, composite, identify) are located.
PHP must be able to call those binaries of course (exec() function must be anabled and this folder must be within open_basedir if used). It works this way since ever :-)
I recall the very few times I used WAMP environment I had no issues with it either.
Simply download the windows binary of ImageMagick and install it.
Inside the installation folder must be a folder called /bin.
The tools needed must be there as exec-files.
Now just set the TYPO3 configuration to point to this folder including the trailing slash.
For windows it must be something like this as I recall.
$TYPO3_CONF_VARS['GFX']['im_path'] = 'C:\\programs\\imagemagick\\bin\\';
You can use the binaries of GraphicsMagic instead of ImageMagick as well.
They are easier to find and perform very well.
Today I have tried to install imagick in my xampp a hundred times. And I did it. If you have troubles, please try following these steps:
Since xampp is x86, check if your Image Magick (the program) is x86. If not, download the latest version here: imagemagick.org/script/binary-releases.php#windows
Please remember that u MUST download the Win32 dynamic at 16 bits-per-pixel.
Install Image Magick at C:\imagemagick.
Download the latest stable version of imagick here: . You MUST download the 5.x Thread Safe (TS) x86. The x in 5.x is the version of your PHP.
Put the php_imagick.dll in php/ext folder of your xampp installation.
Add this in your php.ini: extension=php_imagick.dll
Here is when I have a lot of trouble. If you try to start the server (or writing php in the console (start->cmd)), you will get an error. If that error says something like this: Unable to find the entry point for the procedure FlattenImages in the DLL CORE_RL_magick.dll it means that you're well underway.
Now, you must go into the installation folder of Image Magick and overwrite the DLL you downloaded with the php_imagick.dll. All of them start with the prefix CORE_RL_.
Once you overwrote all of them, you can try writing php in the windows console. I don't say something means that the imagick is functional (you can check in localhost/xampp/ > phpinfo() link. Personally, I had to install a new DLL: vcomp110.dll.
If someone has the same error as me (the system can't found the vcomp11.dd) download it here
Now, if you try executing php on console, or just initializing the apache module of xampp, you should not have errors.
Goodbye and hope I can help someone.
EDIT: when tried to convert some-img.bmp some-result.jpg in the console, I had this error:
convert.exe: unable to open module file 'C:\Users\my-acc\.magick\IM_MOD_RL_BMP_.dll': No such file or directory # ...
This happened when there is no folder .magick in my-acc. The thing you need to do is this:
Create a folder named .magick in the my-acc folder. Since the name starts with a stop, you need to create it through the console. Here are the commands:
1.1. c:
1.2. cd Users\my-acc
1.3. mkdir .magick
Go to C:\imagemagick\modules\coders and copy the entire files into the latest folder created.
Now, you will be able to use Image Magick through the commands or the PHP Classes.
On background, if you use Codeigniter, i have no idea how to use the image_lib with imagick. So, it's better with the own imagick classes. Here a simple example:
$image = new Imagick($upload_data['full_path']);
$image->thumbnailImage(250,0);
if($image->writeImage($upload_data['file_path'].$upload_data['raw_name'].'_thumb'.$upload_data['file_ext'])){
something here;
}
$image->clear();
This answer might be extremely naive, but, I've found that getting things done in Windows is generally too painful. Many people agree with that and have found solace in a tool known as "chocolatey".
First, install chocolatey on your Windows machine (super easy install instructions):
https://chocolatey.org/
Then, use chocolatey to install everything else that you need (imagemagick in this case):
https://chocolatey.org/packages/imagemagick
I suspect you might have to do some minor tweaking to configuration files after that, plus handle all of the "Windows permissions" needed to get things to work smoothly. Permissions are can be as simple (and not necessarily safe) as "full control" to some user, plus activating inheritance and overwriting all children's settings to use inheritance.
In short, install, configure, permissions, go.
PS. This answer might be incomplete/prototypical/experimental, since I don't run codeigniter, php, imagemagick on Windows.
This how-to of Winderfind is wonderful, but for me it was not yet complete to troubleshoot all problems. First of all, have a look at this tutorial:
http://hrt0kmt.hatenablog.com/entry/2015/05/27/170608
Secondly I discovered that not all versions of ImageMagick will work with all versions of php_imagick.dll. Check out my and others answers on this post for further troubleshooting:
ImageMagick supported formats no value
Great tutorial,
If you are running windows 11, and installing xampp with php 8.1, you need to install 64bit versions:
Win32 dynamic at 16 bits-per-pixel
Becomes
Win64 dynamic at 16 bits-per-pixel
And
5.x Thread Safe (TS) x86
Becomes
8.1 Thread Safe (TS) x64
If you've installed the 32bit versions (as I did), you can just download the 64bit versions and overwrite all the files. Then restart apache and it should start working.
I have a PHP site that requires PDF to image conversion, and we're obviously using imagemagick for it.
However, right now we're trying to move to different hosting, and it seems like I will not be able to install imagemagick package on the new hosting to do the same thing as we do now.
So the question is - is there any way to convert PDF to image with either pure PHP means, or with anything else that can be just popped into DOCUMENT_ROOT and do not need to be properly installed into the system.
This is a Linux system, but I have no idea what distribution, and I can't check as my rights in this system are really limited.
thanks
Alex.
"[...] requires PDF to image conversion, and we're obviously using imagemagick for it."
This is not obvious at all.
Because ImageMagick cannot convert PDF to images all by itself. It requires to use Ghostscript as its 'delegate'. So you may have installed ImageMagick, but not installed Ghostscript and it will not work.
Vice versa, you could have Ghostscript installed but not ImageMagick -- and you could still easily convert PDF to images. For instance, convert to JPEG with resolution 144 DPI (without specifying one, you'd get 72 DPI):
gs \
-o out.jpg \
-sDEVICE=jpeg \
-r144 \
in.pdf
Also, you are free to install Ghostscript wherever you want.
(BTW: I'd keep my hands off a hosting provider who does not offer a ImageMagick nor Ghostscript installation, let alone not allow to install it yourself...)
On linux systems statically linked things can work without external library dependencies. So if you could get/create a statically linked imagemagick executable, you could use it directly under docroot. Probably it isnt so trivial.
Or you could use remote sites for doing the conversion for you. Like:
http://pdf2jpg.net/
(For posting to upload forms like this curl will be usefull.)
I am using a Windows XP Home Edition. I need to install a few extensions to PHP -- memcache, APC, .etc. And I would very much like to use PECL to make this happen. The problem is PECL takes it for granted that I will have certain programs on my computer. On another post, I read, for instance, that you need to have Microsoft Visual Studio C++ installed on your machine. However, the new version of Visual Studio, which I downloaded, does not have msdev.exe and instead uses vcbuild.exe, which has a completely different api and fails to compile the .dsp files that come with these modules.
So I tried to find a script that would upgrade the dsp to work with vcbuild.exe...and it turns out vcbuild.exe can do that, but of course that didn't pan out.
Another thing I tried was to find a make script for Windows (nmake2make). But there was no make file in the module's root folder.
I tried also downloading Cygwin and MinGW in hopes of finding a build script that would work as simply as in *nix operating systems, but to no avail.
How else do I use install PHP extensions on a Windows machine? Can anyone help me out of this predicament?
For all peoples coming here to download the dll extension files.
This is the link to the PHP extension download link http://windows.php.net/download/
And this is a list of PHP extensions to download: http://pecl.php.net/package-search.php
For core extensions, or if you cant find any on pecl.php.net, download PHP from a zip http://windows.php.net/download/ and look inside of /ext and copy them to your local php /ext folder.
The only way I can think of is: manually. Yeah, I know, but this is pretty easy comparatively.
If you have the compiler, then you can at least compile an extension if you have the source. Otherwise you're stuck with trying to locate a binary distribution (like me).
Here's what you do, from what I understand:
Put the extension library folder under PHP's install path. On my computer this is C:\xampp\php\ext. Search in your PHP.ini for "extension_dir" to find what yours is.
Edit php.ini to load the extension.
Find ; Dynamic Extensions ;.
Add line extension=my_lib.dll
This should do it. Otherwise you should probably search for an in-depth guide on manual installation.
For memcache you will need the memcache server located here -> http://code.jellycan.com/memcached/ and download the win32 binary
Never used APC :P I use eAccelerator0953_5.2.6 to cache the code