If you have received this error: “PHP: GD2 Not installed:|| File and or directory is invalid”
Than your at the right place…
You may be wondering what GD2 is… the official explanation is
this:“GD is an open source code library for the dynamic creation of images by programmers.”
The reason you are getting this error is most likely because have not installed the GD2 extension in PHP when you first setup your
server. So I will let you know how install it and initialize it in Linux and Windows.
Under Linux::
The easiest way is to use your package manager to install it.
For example in Debian… “apt-get install php5-gd”
or Redhat… “—with-libdir=lib64 —with-gd —with-jpeg-dir —with-png-dir
Under Windows::
You will have to download the .zip archive version of PHP because the binary install doesn’t include most extensions.
Download it here: http://windows.php.net/download/ (Make sure if your using Apache to download the VC6 version).
Copy all the extensions from the “ext” directory from the download into your PHP ext directory (eg: “C:\PHP\ext”) .
You should notice a file called “php_gd2.dll”.
Now to initialize it (like any extension) you have to open your “php.ini” file search for “Dynamic Extensions” and just under that place this exact phrase “extension=php_gd2.dll”.
(Note: make sure that your php.ini file is configured to look in the “C:\PHP\ext” folder for the extensions. Search in the file for “extension_dir”.)
Restart Apache.
And there you have it you now have full GD2 support for PHP. You can now resize, scale and flip images on the fly.
