Linux through the source code to compile the GD library

Source: Internet
Author: User

Because before all through the source code directly installed lamp environment, so many expansion libraries are not installed, suddenly now to use a verification code class, Imagecreate function display is undefined, so to install the compiled GD library,

First, you need to install the GD front-facing library: FreeType, Jpegsrc,libpng.

FreeType

wget "http://download.savannah.gnu.org/releases/freetype/freetype-2.4.0.tar.bz2" Tar jxvf freetype-2.4.0.tar.bz2cd Freetype-2.4.0./configure--prefix=/usr/local/freetype && make && make install

Jpegsrc

wget "http://www.ijg.org/files/jpegsrc.v9.tar.gz" tar zxvf jpegsrc.v9.tar.gzcd jpeg-9        cflags= "-o3-fpic". Configure--prefix=/usr/local/jpeg && make && make installmkdir-p/usr/local/jpeg/includemkdir-p/usr/ Local/jpeg/libmkdir-p/usr/local/jpeg/binmkdir-p/usr/local/jpeg/man/man1    

Libpng

wget "http://ufpr.dl.sourceforge.net/project/libpng/libpng12/1.2.56/libpng-1.2.56.tar.gz"        tar zxvf LIBPNG-1.2.50.TAR.GZCD libpng-1.2.56cflags= "-o3-fpic"./configure--prefix=/usr/local/libpng && Make & & Make Install

After the install succeeds, go to the PHPSRC directory, which is the source package you downloaded previously

cd/home/daneil/downloads/php.5.3.x                //You download PHP version cd/etx/gd//                                        Enter the GD folder

In this directory to execute phpize, using the Phpize case, when we need to add more modules, and do not want to recompile PHP, these we can use the phpize. My PHP is installed in the/usr/local/php/directory, can be modified according to personal circumstances.

./configure--with-php-configure=/usr/local/php/bin/php-config  --with-jpeg-dir=/usr/local/jpeg  -- With-png-dir=/usr/local/libpng   
--with-freetype-dir=/usr/local/freetype

Then modify the php.ini file to add a line under; Extension=php_gd2.dll extension=gd.so

Input/usr/local/php/bin/php-m//load Module

So you can. Then reboot Apache to be OK!

Reference Blog: http://www.nowamagic.net/librarys/veda/detail/2610

Linux through the source code to compile the GD library

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.