MagickWand For PHP Installation Instructions: Windows
Posted: 2005-08-15T16:04:52-07:00
.
UPDATED: Wednesday, September 14, 2005
Several changes have been made to this document -- if you have read it before, it may be in your best interest to skim it again.
The major changes are that there is now only one version of the DLL (per PHP version) that uses installed ImageMagick; the values of certain previously hard coded constants are now dynamically retrieved on module startup.
What this basically means is that the extension now retrieves all of its previously QuantumDepth-dependent values at module startup, not at compile time.
As a result, for those who want a direct shortcut, the list of available Windows DLLs is as follows:
MagickWand For PHP current version (as of 2005-09-13): 0.1.8
Based on / uses: ImageMagick 6.2.4-5 (minimum)
Download from: ftp://ftp.imagemagick.org/pub/ImageMagick/php/ (but read below first)
Introduction
I have spent a large amount of time testing and hacking (think axe, not computer) to get this working (especially for Windows users), so I am going to use this page as a get-you-up-and-running document.
If you have any questions as to the INSTALLATION of MagickWandfor PHP on Windows, palce them in this topic, as I will receive notification of it in my email, and will be able to respond rapidly.
MagickWand For PHP Windows Release formats
In order to accomodate all the various options available to users of ImageMagick & PHP, i.e.:
I have cobbled together a build / distribution system for MagickWand For PHP that tries to accomodate users varied requirements.
Some Advice
If you are a relative novice to the innards of ImageMagick / PHP / Web servers, or you just don't want to be bothered with the treatise which is to follow, my advice to you is to ask your Windows web server's administrator to download
In the document, from this point on, I will refer to the MagickWand for PHP DLLs using the notation:
NOTE the php-[PHP_V]_magickwand_q8_st.dll) at the end of the name -- this indicates that the DLL is a static / self-contained / ImageMagick static lib-based DLL.
This PHP DLL is a fully working self-contained version of MagickWand For PHP (at ImageMagick Quantum Depth 8, more than adequate for the web), which uses no delegate programs, and will get you up and running very quickly.
All you have to do is make sure that the account under which PHP runs has read access to the file, and either put
in your php.ini file, or, put
before any statements that access the MagickWand For PHP API in your PHP scripts.
This ease comes at a price, however, as this DLL allows no access to any delegate programs, so you can't read the PDF / PS formats (although you can write them), along with being unable to read / write a whole slew of other formats which require delegate programs (MPEG, CGM, FIG, etc.).
The list of available formats follows:
If an image format wasn't on that list, it can't be read / written by the MagickWand for PHP DLLs referenced above, as it was disabled in the source code.
Why? Size, speed and security.
If you need a particular format included in your lib-based DLL, send me a private message, and I will see what I can do.
Pre-Installation
For the intrepid, before installing MagickWand for PHP on a Windows system, you have to take stock of your situation, and ask yourself a few questions:
If #2 and #3 are true, you need #1 to be true, or you may need to contact me for a custom solution.
Installation
If you do have control of the server or can get things done on the server, and can install the ImageMagick DLL-based setup distribution, you have the opportunity to have access to the full ImageMagick feature set (read: "access to all the formats ImageMagick is capable of manipulating, as long as you have the required delegate libraries / programs installed").
This does not mean however, that you are required to do this; again, I recommend just installing the self-contained version.
If you do have server control, or can get your friendly neighborhood server admin to do some alterations for you, here's what you need to do / have done...
Read:
Contact Developer
Click here to send me a private message through the message board.
UPDATED: Wednesday, September 14, 2005
Several changes have been made to this document -- if you have read it before, it may be in your best interest to skim it again.
The major changes are that there is now only one version of the DLL (per PHP version) that uses installed ImageMagick; the values of certain previously hard coded constants are now dynamically retrieved on module startup.
What this basically means is that the extension now retrieves all of its previously QuantumDepth-dependent values at module startup, not at compile time.
As a result, for those who want a direct shortcut, the list of available Windows DLLs is as follows:
- PHP 4.4.0
- Using Installed ImageMagick: php-4.4.0_magickwand_dyn.dll
- QuantumDepth 8 (RECOMMENDED): php-4.4.0_magickwand_q8_st.dll
- QuantumDepth 16: php-4.4.0_magickwand_q16_st.dll
- QuantumDepth 32: php-4.4.0_magickwand_q32_st.dll
- PHP 5.0.4
- Using installed ImageMagick: php-5.0.4_magickwand_dyn.dll
- QuantumDepth 8 (RECOMMENDED): php-5.0.4_magickwand_q8_st.dll
- QuantumDepth 16: php-5.0.4_magickwand_q16_st.dll
- QuantumDepth 32: php-5.0.4_magickwand_q32_st.dll
MagickWand For PHP current version (as of 2005-09-13): 0.1.8
Based on / uses: ImageMagick 6.2.4-5 (minimum)
Download from: ftp://ftp.imagemagick.org/pub/ImageMagick/php/ (but read below first)
NOTE:
These instructions would benefit from a discussion of what ImageMagick's Quantum Depth means exactly, but I will leave that for another time / another venue.
Just know that a Quantum Depth of 8 (often noted as Q8 in ImageMagick's documents / filenames, as oppposed to Q16 and Q32) is preferred for use on the web.
Introduction
I have spent a large amount of time testing and hacking (think axe, not computer) to get this working (especially for Windows users), so I am going to use this page as a get-you-up-and-running document.
If you have any questions as to the INSTALLATION of MagickWandfor PHP on Windows, palce them in this topic, as I will receive notification of it in my email, and will be able to respond rapidly.
MagickWand For PHP Windows Release formats
In order to accomodate all the various options available to users of ImageMagick & PHP, i.e.:
(Quantum Depths 8, 16, 32) x (PHP 4, 5) x (ImageMagick static-lib-based, dll-based)
I have cobbled together a build / distribution system for MagickWand For PHP that tries to accomodate users varied requirements.
Some Advice
If you are a relative novice to the innards of ImageMagick / PHP / Web servers, or you just don't want to be bothered with the treatise which is to follow, my advice to you is to ask your Windows web server's administrator to download
(or do it yourself if you have the access) and place it in your webserver's PHP extension directory.[PHP 4.4.0]
ftp://ftp.imagemagick.org/pub/ImageMagi ... _q8_st.dll
or
[PHP 5.0.4]
ftp://ftp.imagemagick.org/pub/ImageMagi ... _q8_st.dll
In the document, from this point on, I will refer to the MagickWand for PHP DLLs using the notation:
where "[PHP_V]" serves as a stand-in for the PHP version of the DLL, either 4.4.0, or 5.0.4.php-[PHP_V]_magickwand_q8_st.dll
NOTE the php-[PHP_V]_magickwand_q8_st.dll) at the end of the name -- this indicates that the DLL is a static / self-contained / ImageMagick static lib-based DLL.
This PHP DLL is a fully working self-contained version of MagickWand For PHP (at ImageMagick Quantum Depth 8, more than adequate for the web), which uses no delegate programs, and will get you up and running very quickly.
All you have to do is make sure that the account under which PHP runs has read access to the file, and either put
extension="php-[PHP_V]_magickwand_q8_st.dll"
in your php.ini file, or, put
dl('php-[PHP_V]_magickwand_q8_st.dll');
before any statements that access the MagickWand For PHP API in your PHP scripts.
This ease comes at a price, however, as this DLL allows no access to any delegate programs, so you can't read the PDF / PS formats (although you can write them), along with being unable to read / write a whole slew of other formats which require delegate programs (MPEG, CGM, FIG, etc.).
The list of available formats follows:
BMP, BMP2, BMP3, CACHE, CAPTION, CLIP, CUR, DNG, EPDF, FAX, FRACTAL, G3, GIF, GIF87, GRADIENT, HISTOGRAM, ICO, ICON, INFO, JNG, JPEG, JPG, LABEL, MAP, MATTE, MIFF, MNG, MPC, MVG, NULL, P7, PATTERN, PBM, PDF, PFA, PFB, PGM, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PTIF, STEGANO, SVG, SVGZ, TEXT, TIF, TIFF, TILE, TTC, TTF, TXT, VID, XC
If an image format wasn't on that list, it can't be read / written by the MagickWand for PHP DLLs referenced above, as it was disabled in the source code.
Why? Size, speed and security.
- Size: many of the formats ImageMagick manipulates it does so via API interfaces. With DLL-based ImageMagick, that is fine, as the code that is needed is located in external .dll files and is only loaded when needed. But for a self-contained / relocatable PHP DLL, all the ImageMagick+delegate code has to be compiled in, and that makes for a massive PHP DLL if all the possible formats were included.
- Speed: more formats = larger PHP DLL = longer load time + more memory.
- Security: some of the delegate formats are accessed via programs (Ghostscript, for example), and since part of the reason that I started down the MagickWand For PHP path was that I did not like more programs running on my server than were necessary, not to mention the possible security concerns (i.e.: exactly what is that program that is being run in the "background" doing?)
If you need a particular format included in your lib-based DLL, send me a private message, and I will see what I can do.
Pre-Installation
For the intrepid, before installing MagickWand for PHP on a Windows system, you have to take stock of your situation, and ask yourself a few questions:
- Do you have control over the server where you are going to install MagickWand For PHP or can you get the administrator to install software and change server environment variables for you?
- Do the formats you will be handling require that ImageMagick use a "delegate" program to read or write them? (For example reading PDF / PS requires Ghostscript to be installed)
- Do you need access to formats not on the following list:
(Please note: NONE of the X-11 based formats are listed as installed by default!)BMP, BMP2, BMP3, CACHE, CAPTION, CLIP, CUR, DNG, EPDF, FAX, FRACTAL, G3, GIF, GIF87, GRADIENT, HISTOGRAM, ICO, ICON, INFO, JNG, JPEG, JPG, LABEL, MAP, MATTE, MIFF, MNG, MPC, MVG, NULL, P7, PATTERN, PBM, PDF, PFA, PFB, PGM, PJPEG, PLASMA, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PTIF, STEGANO, SVG, SVGZ, TEXT, TIF, TIFF, TILE, TTC, TTF, TXT, VID, XC
If #2 and #3 are true, you need #1 to be true, or you may need to contact me for a custom solution.
Installation
If you do have control of the server or can get things done on the server, and can install the ImageMagick DLL-based setup distribution, you have the opportunity to have access to the full ImageMagick feature set (read: "access to all the formats ImageMagick is capable of manipulating, as long as you have the required delegate libraries / programs installed").
This does not mean however, that you are required to do this; again, I recommend just installing the self-contained version.
If you do have server control, or can get your friendly neighborhood server admin to do some alterations for you, here's what you need to do / have done...
- First, install the DLL-based ImageMagick version (or higher) referenced at the start of this document. For Windows, the setups can be found here:
The files you need are namedImageMagick-[VERSION]-Q[QUANTUMDEPTH]-windows-dll.exe
e.g.: ImageMagick-6.2.4-0-Q8-windows-dll.exe
I suggest the Q8 version, as it is faster / less memory intensive than the other options, and is perfect for the web.
It would be wise to install ImageMagick to a directory whose path contains no spaces, so the default
is not a good location."C:\Program Files"
Also, think ahead -- DO NOT install ImageMagick to a version numbered directory, e.g.:C:\ImageMagick-6.2.4
Instead, install it into a generic directory, e.g.:
so that when you upgrade it, you won't cause yourself confusion, and you won't have to change your setup (see next section).C:\ImageMagick - Next, add the ImageMagick_Install_Dir (wherever you installed ImageMagick) to your server'sPATH
environment variable, and addMAGICK_HOME=ImageMagick_Install_Dir
to your web server's environment variables. An example of how do this in Apache isSetEnv MAGICK_HOME C:/ImageMagick/Q8-DLL
The PATH variable is used to find ImageMagick's DLLs so they can be loaded into memory, and the MAGICK_HOME variable is used by ImageMagick to find it's delegates. - Download the appropriate DLL
to your PHP extension directory.[PHP 4.4.0]
ftp://ftp.imagemagick.org/pub/ImageMagi ... nd_dyn.dll
or
[PHP 5.0.4]
ftp://ftp.imagemagick.org/pub/ImageMagi ... nd_dyn.dll
Note the _dyn (for dynamic), as this PHP DLL searches at runtime (i.e. dynamically) for the ImageMagick libraries on which it depends. - Putextension="php-[PHP_V]_magickwand_dyn.dll"
in your php.ini file, or, putdl('php-[PHP_V]_magickwand_dyn.dll');
before any statements that access the MagickWand For PHP API in your PHP scripts.
Read:
for additional information.
Contact Developer
Click here to send me a private message through the message board.