Linux compile php gd extension ____linux

Source: Internet
Author: User
Tags zts

1: Install the GD dependency pack

Yum-y Install GD gd2 gd-devel gd2-devel zlib freetype

To install JPEG:

wget http://www.ijg.org/files/jpegsrc.v9b.tar.gz

TAR-XVF jpegsrc.v9b.tar.gz

./configure--prefix=/usr/local/jpeg--enable-shared--enable-static

Make && make install

2: Enter PHP extended directory compilation extension

cd PHP source Pack/ext//ext/gd For example:/USR/LOCAL/SRC/PHP-5.5.37/EXT/GD

Executive:/usr/local/php/bin/phpize

Compiling GD extensions:

./configure--with-php-config=/usr/local/php/bin/php-config-with-png-dir--with-freetype-dir--with-jpeg-dir=/usr /local/jpeg-with-zlib-dir--WITH-GD

Make

Make install

This will prompt: Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212 (this path is the extended path)

cd/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212

You can see the extension: The gd.so extension has been compiled successfully

3: The compiled GD extension is added to PHP

Open php.ini

Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212"//Set extension path

extension=gd.so//Add GD extension

4: Problems encountered in compiling

The first time I compiled:./configure--with-php-config=/usr/local/php/bin/php-config--with-jpeg=/usr/local/jpeg--with-png-- With-freetype--with-zlib--WITH-GD

Then after compiling the installation installation, the GD extension was found to be successful, but some of the built-in functions in PHP didn't work.

Replace the one above: remember to make clean or the change will fail


--with-freetype and--with-freetype-dir differences:




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.