Necessary Modifications to PHP
Beginning with version 4.3.0, the PHP distribution includes a bundled version of Thomas Boutell's GD graphics library. The inclusion of this library eliminates the need to download and install many different third-party libraries, but this library will need to be activated at installation time.Chapter 3, "Installing and Configuring PHP," and are stuck with a version of PHP earlier than 4.3.0, you will have to go to http://www.boutell.com/gd/ and download the source of the GD library. Follow the instructions included with that software, and consult its manual for difficulties with installation.
To enable the use of the GD library at installation time, Linux/Unix users must add the following to the configure parameters when preparing to build PHP:
--with-gd
![]() | If you download your own version of GD, you must specify the path, as in --with-gd=/path/to/gd. |
After running the configure program again, you must go through the make and make install process as you did in Chapter 3. Windows users who want to enable GD simply have to activate php_gd2.dll as an extension in the php.ini file, as you learned in Chapter 3.
When using the GD library, you are limited to working with files in GIF format. However, by installing additional libraries, you can work with JPEG and PNG files as well.
Obtaining Additional Libraries
Working with GIF files might suit your needs perfectly, but if you want to create JPEG or PNG files, you will need to download and install a few libraries, and make some modifications to your PHP installation.
JPEG libraries and information can be found at
PNG libraries and information can be found at http://www.libpng.org/pub/png/libpngl.
If you are working with PNG files, you should also install the zlib library, found at http://www.gzip.org/zlib/.
Follow the instructions at these sites to install the libraries. After installation, Linux/Unix users must again reconfigure and rebuild PHP by first adding the following to the configure parameters (assuming that you want to use all three):
--with-jpeg-dir=[
path to jpeg directory ]
--with-png-dir=[
path to PNG directory ]
--with-zlib=[
path to zlib directory ]
After running the configure program again, you need to go through the make and make install process as you did in Chapter 3. Your libraries should then be activated and ready for use.