GD installation in PHP

Source: Internet
Author: User
This article aims to introduce the installation of PHP image processing support. after installation, PHP supports images in GIF, PNG, JPEG, and WBMP formats. for detailed installation and setting steps of PHP, see the relevant tutorial. 1. install images in Windows: it is very easy to install images in Windows. the php package on the website http://www.php4win.de/contains all the images, including php_gd.

This article describes how to install PHP image processing. after installation, PHP supports GIF, PNG, JPEG, and WBMP.

For details about how to install and set up PHP images in four formats, see the relevant tutorial.

 

1. installation in Windows:

Windows image support installation is very simple, in site http://www.php4win.de/

The downloaded PHP contains support for all images. php_gd.dll does not support GIF format and php_gd_gif.dll

All the preceding formats are supported. you only need to use php_gd_gif.dll to overwrite php_gd.dll.

You can.

Use The result is as follows:

Gd

GD Support enabled

GD Version 1.6.2 or higher

FreeType Support enabled

FreeType Linkage with TTF library

GIF Support enabled

JPG Support enabled

PNG Support enabled

WBMP Support enabled

 

II. installation in Unix/linux

Unix installation is more troublesome, the latest php 4.0.4pl1 as an example to introduce the gd-1.8.3 under Solaris 7

Including the installation supported by gif.

System environment: Solaris 7, gcc 2.9.2, make 3.78.1, bison 1.2.8

 

Jpeg-6b installation:

File name: jpeg-6b-sol7-sparc-local.gz

Version: 6b

Site: http://www.sunfreeware.com/

Download location: ftp://ftp.sunfreeware.com/pub/freeware/sparc/7/jpeg-6b-sol7-sparc-local.gz

Installation method:/usr/local/bin/gzip-d jpeg-6b-sol7-sparc-local.gz

Pkgadd-d jpeg-6b-sol7-sparc-local

 

Zlib installation:

File name: zlib-1.1.3-sol7-sparc-local.gz

Version: 1.1.3

Site: http://www.sunfreeware.com/

Download location: ftp://ftp.sunfreeware.com/pub/freeware/sparc/7/zlib-1.1.3-sol7-sparc-local.gz

Installation method:/usr/local/bin/gzip-d zlib-1.1.3-sol7-sparc-local.gz

Pkgadd-d zlib-1.1.3-sol7-sparc-local

 

Libpng installation:

File name: libpng-1.0.2-sol7-sparc-local.gz

Version: 1.0.2

Site: http://www.sunfreeware.com/

Download location: ftp://ftp.sunfreeware.com/pub/freeware/sparc/7/libpng-1.0.2-sol7-sparc-local.gz

Installation method:/usr/local/bin/gzip-d libpng-1.0.2-sol7-sparc-local.gz

Pkgadd-d libpng-1.0.2-sol7-sparc-local

 

Xpm installation:

File name: xpm-3.4k-sol7-sparc-local.gz

Version: 3.4

Site: http://www.sunfreeware.com/

Download location: ftp://ftp.sunfreeware.com/pub/freeware/sparc/7/xpm-3.4k-sol7-sparc-local.gz

Installation method:/usr/local/bin/gzip-d xpm-3.4k-sol7-sparc-local.gz

Pkgadd-d xpm-3.4k-sol7-sparc-local

 

Freetype installation:

File name: freetype-1.3.1.tar.gz

Version: 1.3.1

Site: http://freetype.sourceforge.net/

Download location: ftp://freetype.sourceforge.net/pub/freetype/freetype1/freetype-1.3.1.tar.gz

Installation method:/usr/local/bin/gzip-d <freetype-1.3.1.tar.gz | tar vxf-

Cd freetype-1.3.1

./Configure

Make

Make install

 

Install T1lib:

File name: t1lib-1.0.1.tar.gz

Version: 1.0.1

Site: ftp://ftp.neuroinformatik.ruhr-uni-bochum.de/pub/software/t1lib/

Download location: ftp://ftp.neuroinformatik.ruhr-uni-bochum.de/pub/software/t1lib/t1lib-1.0.1.tar.gz

Installation method:/usr/local/bin/gzip-d <t1lib-1.0.1.tar.gz | tar vxf-

Cd T1-1.0.1

./Configure

Make

Make install

 

Gd installation:

File name: gd-1.8.3gif.tar.gz

Version: 1.8.3

Site: http://www.rime.com.au/gd/

Download location: ftp://ftp.rhyme.com.au/pub/gd/gd-1.8.3gif.tar.gz

Installation method:/usr/local/bin/gzip-d <gd-1.8.3gif.tar.gz | tar vxf-

Cd gd-1.8.3

./Configure

(Edit the Makefile file.

Change CFLAGS =-O to CFLAGS =-O-DHAVE_XPM-DHAVE_JPEG-DHAVE_LIBTTF

Change LIBS =-lm-lgd-lpng-lz to LIBS =-lm-lgd-lpng-lz-ljpeg-lttf-lXpm-lX11.

Modify INCLUDEDIRS =-I.-I/usr/local/include-I/usr/include/X11-I/usr/X11R6/include/X11

Is INCLUDEDIRS =-I. -I/usr/local/include-I/usr/include/X11-I/usr/X11R6/include/X11-I/usr/local/include/freetype

)

Make

Make install

 

PHP installation:

File name: php-4.0.4pl1.tar.gz

Version: 4.04 Patch Level 1

Site: http://www.php.net/

Download location: http://www.php.net/do_download.php? Download_file1_php-4.0.4pl1.tar.gz & source_site = www.php.net

Installation method:/usr/local/bin/gzip-d <php-4.0.4pl1.tar.gz | tar vxf-

./Configure -- with-apache = ../apache_1.3.17 -- with-gd =/usr/local \

-- With-jpeg-dir =/usr/local -- with-xpm-dir =/usr/local \

-- With-ttf =/usr/local/freetype -- with-t1lib =/usr/local \

-- With-zlib =/usr/local -- with-tiff-dir =/usr/local \

-- With-png-dir =/usr/local

(Edit ext/gd. c

Find # ifndef USE_GD_IOCTX and add # define gdImageCreateFromGifCtx NULL

Replace _ php_image_create_from (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageCreateFromGif, NULL );

It is _ php_image_create_from (INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", dImageCreateFromGif, gdImageCreateFromGifCtx );

)

Make

Make install

 

You can add PHP compilation options to meet your needs. the installation in linux is similar,

 

Use The result is as follows:

Gd

GD Support enabled

GD Version 1.6.2 or higher

FreeType Support enabled

FreeType Linkage with TTF library

T1Lib Support enabled

GIF Support enabled

JPG Support enabled

PNG Support enabled

WBMP Support enabled

 

We hope the above will help you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.