Necessary Modifications to PHP


Current versions of the PHP distribution include a bundled version of Thomas Boutell's GD graphics library. The inclusion of this library eliminates the need to download and install several third-party libraries, but this library will need to be activated at installation time.

By the Way

If you cannot install PHP as directed in Chapter 4, "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 

By the Way

If you download your own version of GD, you must specify the path, as in --with-gd=/path/to/gd.


After running the PHP configure program again, you must go through the make and make install process as you did in Chapter 4. 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 4.

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 ftp://ftp.uu.net/graphics/jpeg/.

  • PNG libraries and information can be found at http://www.libpng.org/pub/png/libpng.html.

  • 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 PHP configure parameters (assuming that you want to use all three, if not, just add the applicable ones):

 --with-jpeg-dir=[path to jpeg directory] --with-png-dir=[path to PNG directory] --with-zlib=[path to zlib directory] 

After running the PHP configure program again, you need to go through the make and make install process as you did in Chapter 4. Your libraries should then be activated and ready for use.



Sams Teach Yourself PHP MySQL and Apache All in One
Sams Teach Yourself PHP, MySQL and Apache All in One (4th Edition)
ISBN: 067232976X
EAN: 2147483647
Year: 2003
Pages: 333
Authors: Julie Meloni

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net