It sounds like you downloaded the Windows Installer version of PHP, which does not come with any extensions.
To get the extensions, download this zip and place the "extensions" folder in your 'D:\PHP' folder. Also note that you may need to copy the files in the 'dlls' folder from the zip into 'windows\system32' (on whatever drive you installed Windows). If you aren't sure, copy them anyway, as they won't harm your system if you don't need them.
You can then use the gd2 extension using the change you made.
NOTE: You do not have the latest release of PHP 4. The latest release is PHP 4.3.11 (at the time of this post). Consider upgrading to ensure you haven't missed any bugs/compliancy fixes.