The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP GD Library

Discussion in 'General Discussion' started by ronaldoo, Jul 10, 2009.

  1. ronaldoo

    ronaldoo Active Member

    Joined:
    Jun 16, 2009
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Hello friends,
    Anyone can tell me how can I enable or install the GD Library of PHP?
    Thanks all!
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You will need root access to the server to do this.

    1. Go to WHM -> Software -> EasyApache
    2. proceed through to step 5 of EasyApache
    3. Click on Exhaustive Options List
    4. Check the box for GD
    5. Save & Build.
     
  3. ronaldoo

    ronaldoo Active Member

    Joined:
    Jun 16, 2009
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Was solved, thank you!
     
  4. Janak

    Janak Well-Known Member

    Joined:
    Jul 18, 2009
    Messages:
    71
    Likes Received:
    1
    Trophy Points:
    6
    There is also an another way to enable GD.

    You can also do it from SSH. Run easyapache script and then go to Exhaustive Options List and select GD.
     
  5. ronaldoo

    ronaldoo Active Member

    Joined:
    Jun 16, 2009
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Ok, thanks!
     
  6. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    And there is another way :D ...

    If you want GD to really work 100% ...

    Compile PHP manually!

    (Actually there is reason for this if you are wanting full GD and have all the functions and components actually work correctly)

    Open a phpinfo() screen to get your current ./configure options as you'll need the rest of your options later below as !!!OPTIONS!!!

    Code:
    # yum install coreutils make gcc* glib* libexif libjpeg* libpng* giflib* gd gd-* netpbm Image* freetype*
    # /scripts/checkperlmodules    (might want to do this 2 or three times)
    
    At this point you should have an updated compile environment along with the main libraries you will need to build a good GD environment.

    Code:
    # cd /usr/local/src
    # wget http://us3.php.net/get/php-5.2.10.tar.bz2/from/us2.php.net/mirror
    # tar jxvf ./php-5.2.10.tar.bz2
    # cd php-5.2.10
    # ./configure --with-zlib --with-zlib-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf --with-ttf --with-exif --with-gd --with-imagick  !!!YOUR OTHER OPTIONS!!!
    
    (Note the [b][u]order of the options[/u][/b] I've shown --- That is important!)
    
    # make
    # make test
    # make install
    
    Depending on whether you are using DSO or SuPHP based PHP per the rest of your configure options taken from your current PHP installation, you may or may not need to go update httpd.conf or /opt/suphp/etc/suphp.conf.

    Restart your apache server
    Code:
    service httpd restart
    You should now have a well working GD2 system if all went well.

    The pre-requisite yum installer I gave you also asked to install ImageMagick which is another very powerful graphics package that a lot of PHP scripts like to use. There is an optional module you can add to PHP to give you direct ImageMagick functions from within PHP.

    Code:
    # cd /usr/local/src/php-5.2.10/ext
    # wget http://pecl.php.net/get/imagick-2.3.0RC2.tgz
    # tar zxvf ./imagick-2.3.0RC2.tgz
    # mv imagick-2.3.0 imagick
    # cd imagick
    # phpize
    # ./configure 
    # make
    # make test
    # make install
    
    You should now have a line in your /usr/local/lib/php.ini file to load the extension that looks like the following:

    Code:
    extension=imagick.so
    
    Alternatively you could do everything up to the "phpize" command above after you unpacked your original php-5.2.10.tar.bz2 archive but before you compiled PHP and then added "--with-imagick" to the end of the original GD configure options when you compiled PHP and you will have the optional ImageMagick support (imagick) add-on module hard compiled directly into PHP itself instead of being loaded as an external extension module.
     
Loading...

Share This Page