How to install PHP GD support library under Linux

Source: Internet
Author: User
Tags zts
    1. Gd-2.0.33.tar.gz http://www.boutell.com/gd/
    2. Jpegsrc.v6b.tar.gz http://www.ijg.org/
    3. Libpng-1.2.7.tar.tar http://sourceforge.net/projects/libpng/
    4. Zlib-1.2.2.tar.gz http://sourceforge.net/projects/zlib/
    5. freetype-2.1.9.tar.gzhttp://sourceforge.net/projects/freetype/
    6. Php-4.3.9.tar.gz http://www.php.net
Copy Code

Second, installation

1. Installing zlib

    1. Tar zxvf zlib-1.2.2.tar.gz
    2. CD zlib-1.2.2
    3. ./configure
    4. Make
    5. Make install
Copy Code

2. Installing libpng

    1. Tar zxvf Libpng-1.2.7.tar.tar
    2. CD libpng-1.2.7
    3. CD scripts/
    4. MV Makefile.linux. /makefile
    5. Cd..
    6. Make
    7. Make install
Copy Code

Note that the makefile here is not built with./configure, but instead directly from the scripts/.

3. Installing FreeType

    1. Tar zxvf freetype-2.1.9.tar.gz
    2. CD freetype-2.1.9
    3. ./configure
    4. Make
    5. Make install
Copy Code

4. Install JPEG

    1. Tar zxvf jpegsrc.v6b.tar.gz
    2. CD jpeg-6b/
    3. ./configure--enable-shared
    4. Make
    5. Make Test
    6. Make install
Copy Code

Note that this configure must take the--enable-shared parameter, otherwise, the shared library will not be generated

5. Install GD

    1. Tar zxvf gd-2.0.33.tar.gz
    2. CD gd-2.0.33
    3. ./configure--with-png--with-freetype--with-jpeg
    4. Make install
Copy Code

The above installation steps are not set the installation directory, test recompile PHP with the above method can be. To specify the installation address, it is recommended that you define the installation directory as follows. 1, installation Zlib

    1. wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/zlib-1.2.3.tar.gz
    2. TAR-ZXF zlib-1.2.3.tar.gz
    3. CD zlib-1.2.3
    4. ./configure–prefix=/usr/local/zlib
    5. Make
    6. Make install
Copy Code

2. Install JPEG

    1. wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/jpeg-6b.tar.gz
    2. Mkdir-p/usr/local/jpeg6
    3. Mkdir-p/usr/local/jpeg6/bin
    4. Mkdir-p/usr/local/jpeg6/lib
    5. Mkdir-p/usr/local/jpeg6/include
    6. Mkdir-p/usr/local/jpeg6/man
    7. Mkdir-p/usr/local/jpeg6/man1
    8. Mkdir-p/usr/local/jpeg6/man/man1
    9. TAR-ZXF jpeg-6b.tar.gz
    10. CD jpeg-6b
    11. ./configure–prefix=/usr/local/jpeg6–enable-shared–enable-static
    12. Make
    13. Make install
Copy Code

Installation complete prompt: Libraries has been installed in:/usr/local/jpeg6/lib 3, installation libpng

    1. wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/libpng-1.2.16.tar.gz
    2. TAR-ZXF libpng-1.2.16.tar.gz
    3. CD libpng-1.2.16
    4. ./configure–prefix=/usr/local/libpng
    5. Make
    6. Make install
Copy Code

4, Installation FreeType

    1. wget http://download.savannah.nongnu.org/releases/freetype/freetype-2.3.4.tar.gz
    2. TAR-ZXF freetype-2.3.4.tar.gz
    3. CD freetype-2.3.4
    4. Mkdir-p/usr/local/freetype
    5. ./configure–prefix=/usr/local/freetype
    6. Make
    7. Make install
Copy Code

5. Installing GD

    1. wget ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/gd-2.0.33.tar.gz
    2. TAR-ZXF gd-2.0.33.tar.gz
    3. CD gd-2.0.33
    4. Mkdir-p/USR/LOCAL/GD2
    5. ./configure–prefix=/usr/local/gd2–with-jpeg=/usr/local/jpeg6/–with-png=/usr/local/lib/–with-zlib=/usr/local/ lib/–with-freetype=/usr/local/freetype/
    6. Make
    7. Make install
Copy Code

When installing JPG, if there is an error, you need to install LIBTOOL:LIBTOOL-1 first. X.tar.gz//is the version I downloaded

    1. ./configure
    2. Make
    3. Make install
    4. Re-install jpegsrc.v6b.tar.gz
    5. ./configure--enable-shared--enable-static The default path for these LIB packets is OK.
Copy Code

Otherwise, if the other needs this package, it's going to be a path where it's going to go wrong. Checking Host system Type ... Invalid configuration ' X86_64-unknown-linux-gnu ': Machine ' x86_64-unknown ' not recognized checking build system type ... Invalid configuration ' X86_64-unknown-linux-gnu ': Machine ' x86_64-unknown ' not recognized Configure:error:libtool conf Igure failed or/libtool--mode=compile gcc-o2-i.-C./jcapimin.c make:./libtool: Command not found make: * * * [Jcapimin.lo] Error 127. /libtool--mode=compile gcc-o2-i.-C./cjpeg.c make:./libtool: Command not found make: * * * [Cjpeg.lo] Error 127 workaround CP/USR/SHARE/LIBT Ool/config/config.guess. Cp/usr/share/libtool/config/config.sub. CP to the JPEG installation file directory, note the following "." Make clean again./configure--prefix=/usr/local/libjpeg/--enable-shared--enable-static make Make install--------------------------------If you have already installed PHP, it is recommended that you enter the "[PHP Extract Directory]/ext/gd" directory by appending the compiled installation, and execute the following command: [PHP installation directory]/bin/ Phpize./configure--with-php-config=[php installation directory]/bin/php-config--with-jpeg=[jpeg-6b installation directory]--with-png=[libpng installation directory]-- With-freetype=[freetype installation directory]--with-gettext=[geTtext installation directory]--WITH-GD=[GD installation directory "[PHP installation directory]/lib/php/extensions/no-debug-non-zts-20060613] After successful installation of make makes install Directory to generate the gd.so file, then CP [PHP installation directory]/lib/php/extensions/no-debug-non-zts-20060613/gd.so/opt/php/ext Modify the php.ini file load GD component, add Extension_dir=/opt/php/ext and extension=gd.so, if there is extension_dir=/opt/php/ext do not need to add extension_ Dir=/opt/php/ext extension=gd.so

  • 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.