PHP Installing GD

Feb 04, 2009 Author: GDchart-Master

Just in case you missed installing the GD library when you were setting up PHP, I’ll
quickly go over it again. I will also show you a great little chunk of code that you can use
to load the library dynamically.
To install GD on a Linux or UNIX installation you will need to recompile PHP with
the --with-gd option. You can also compile the GD library as a shared object so you can
load the GD library dynamically whenever you need it. To do this you would use the
--with-gd=shared option. Then, to load in the library dynamically at run time, you would
use the following line of code:
dl(‘gd.so’);
To install GD on a Windows platform you need to copy the php_gd2.dll that came with
the installation package into the extensions directory specified in the php.ini file. Then
you will need to edit the php.ini file and uncomment the following line:
extension=php_gd2.dll
This will enable access to the GD library. If you would like to load the extension dynamically
with script you may do so with the following line of code:
dl(‘php_gd2.dll’);

 

In order to dynamically load an extension, the shared object file (UNIX) or the dll file (Windows)
must be in the extensions directory specified in the php.ini file


views 4489
  1. Add New Comment