Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Enable GD Library in PHP with FreeType,LibPNG and LibJpeg  (Read 4843 times)

0 Members and 1 Guest are viewing this topic.

vinayakp

  • Guest
Enable GD Library in PHP with FreeType,LibPNG and LibJpeg
« on: August 23, 2017, 09:36:39 am »
In PHP we can control image files using GD library.It supports most known formats which includes GIF,PNG,JPEG,etc.We can use LibGD library to stream images directly from our application to the browser.

Enabling GD library through WHM
-------------------------------

Login to WHM >> Software >> EasyApache

If the Cpanel build is out of date it will prompt for an upgrade, Select Begin 'Customizing Based on Current Profile'.

Proceed further with steps until the step 5.On step 5 select 'Exhaustive Options' and check the option for GD under PHP.

Proceed with the Build and Compile process.


Compling via command line
--------------------------------

1)  wget http://www.ijg.org/files/jpegsrc.v9.tar.gz

2)  tar xvfz jpegsrc.v9.tar.gz

    cd jpeg-9

    ./configure

    make

    make install

This will install the jpeg libraries in the default /usr/local/bin

3)    Download the FreeType Library

    wget http://iweb.dl.sourceforge.net/project/freetype/freetype2/2.5.0/freetype-2.5.0.1.tar.bz2

    tar xvfj freetype-2.5.0.1.tar.bz2

    cd freetype-2.5.0.1/

    make

    make install

4) Install LibPNG

    rpm -qa | egrep 'jpg|png'

        libpng-devel-1.2.10-7.1.el5_0.1
        libpng-1.2.10-7.1.el5_0.1

    Install using yum

5) Install PHP from source

    wget http://am1.php.net/distributions/php-5.6.30.tar.bz2

    bzip2 -d php-5.2.6.tar.bz2

    tar xvf php-5.2.6.tar

6) Compile PHP

    ./configure \
     --with-apxs2=/usr/local/apache2/bin/apxs  \
     --with-mysql \
     --with-gd \
     --with-jpeg-dir \
     --enable-gd-native-ttf \
     --with-freetype-dir \

    make

    make install


7) Verify GD is enabled in PHP

    Create a test php page with phpinfo() and view in browser.