Sunday, June 3, 2012

Install GD Library For PHP5 On CentOS 6


Install GD Library For PHP5 On CentOS

Note: this article only applies if your current PHP version has been installed by yum. If you custom compiled it from source, this will not work.



Verify PHP as installed by yum

An easy task, using yum. First step, see if it's already installed.
[root@homeserver]# rpm -qa | grep php
php-common-5.1.6-15.el5
php-cli-5.1.6-15.el5
php-5.1.6-15.el5
php-pdo-5.1.6-15.el5
php-mysql-5.1.6-15.el5

Install the GD library using yum

If the GD Library isn't present in that list, it wasn't installed on the server yet. Install it using yum.
[root@homeserver]# yum install php-gd
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
epel/metalink                                                                                                                 | 5.0 kB     00:00     
 * base: ftp.iij.ad.jp
 * epel: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
base                                                                                                                          | 3.7 kB     00:00     
extras                                                                                                                        | 3.5 kB     00:00     
updates                                                                                                                       | 3.5 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-gd.x86_64 0:5.3.3-3.el6_2.8 will be installed
--> Processing Dependency: libpng12.so.0(PNG12_0)(64bit) for package: php-gd-5.3.3-3.el6_2.8.x86_64
--> Processing Dependency: libpng12.so.0()(64bit) for package: php-gd-5.3.3-3.el6_2.8.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: php-gd-5.3.3-3.el6_2.8.x86_64
--> Processing Dependency: libfreetype.so.6()(64bit) for package: php-gd-5.3.3-3.el6_2.8.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.3.3-3.el6_2.8.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: php-gd-5.3.3-3.el6_2.8.x86_64
--> Running transaction check
---> Package freetype.x86_64 0:2.3.11-6.el6_2.9 will be installed
---> Package libX11.x86_64 0:1.3-2.el6 will be installed
--> Processing Dependency: libX11-common = 1.3-2.el6 for package: libX11-1.3-2.el6.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.3-2.el6.x86_64
---> Package libXpm.x86_64 0:3.5.8-2.el6 will be installed
---> Package libjpeg.x86_64 0:6b-46.el6 will be installed
---> Package libpng.x86_64 2:1.2.49-1.el6_2 will be installed
--> Running transaction check
---> Package libX11-common.noarch 0:1.3-2.el6 will be installed
---> Package libxcb.x86_64 0:1.5-1.el6 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.5-1.el6.x86_64
--> Running transaction check
---> Package libXau.x86_64 0:1.0.5-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================
 Package                               Arch                           Version                                  Repository                       Size
=====================================================================================================================================================
Installing:
 php-gd                                x86_64                         5.3.3-3.el6_2.8                          updates                         104 k
Installing for dependencies:
 freetype                              x86_64                         2.3.11-6.el6_2.9                         updates                         359 k
 libX11                                x86_64                         1.3-2.el6                                base                            582 k
 libX11-common                         noarch                         1.3-2.el6                                base                            188 k
 libXau                                x86_64                         1.0.5-1.el6                              base                             22 k
 libXpm                                x86_64                         3.5.8-2.el6                              base                             59 k
 libjpeg                               x86_64                         6b-46.el6                                base                            134 k
 libpng                                x86_64                         2:1.2.49-1.el6_2                         updates                         182 k
 libxcb                                x86_64                         1.5-1.el6                                base                            100 k

Transaction Summary
=====================================================================================================================================================
Install       9 Package(s)

Total download size: 1.7 M
Installed size: 5.9 M
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 1.7 M
(1/9): freetype-2.3.11-6.el6_2.9.x86_64.rpm  | 359 kB     00:00     
(2/9): libX11-1.3-2.el6.x86_64.rpm           | 582 kB     00:00     
(3/9): libX11-common-1.3-2.el6.noarch.rpm    | 188 kB     00:00     
(4/9): libXau-1.0.5-1.el6.x86_64.rpm         |  22 kB     00:00     
(5/9): libXpm-3.5.8-2.el6.x86_64.rpm         |  59 kB     00:00     
(6/9): libjpeg-6b-46.el6.x86_64.rpm          | 134 kB     00:00     
(7/9): libpng-1.2.49-1.el6_2.x86_64.rpm      | 182 kB     00:00     
(8/9): libxcb-1.5-1.el6.x86_64.rpm           | 100 kB     00:00     
(9/9): php-gd-5.3.3-3.el6_2.8.x86_64.rpm     | 104 kB     00:00     
--------------------------------------------------------------------
Total                                                                                                                736 kB/s | 1.7 MB     00:02     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 2:libpng-1.2.49-1.el6_2.x86_64    1/9 
  Installing : libX11-common-1.3-2.el6.noarch    2/9 
  Installing : libXau-1.0.5-1.el6.x86_64         3/9 
  Installing : libxcb-1.5-1.el6.x86_64           4/9 
  Installing : libX11-1.3-2.el6.x86_64           5/9 
  Installing : libXpm-3.5.8-2.el6.x86_64         6/9 
  Installing : libjpeg-6b-46.el6.x86_64          7/9 
  Installing : freetype-2.3.11-6.el6_2.9.x86_64  8/9 
  Installing : php-gd-5.3.3-3.el6_2.8.x86_64     9/9 
Installed:
  php-gd.x86_64 0:5.3.3-3.el6_2.8                                                                                                                    

Dependency Installed:
  freetype.x86_64 0:2.3.11-6.el6_2.9       
  libX11.x86_64 0:1.3-2.el6
  libX11-common.noarch 0:1.3-2.el6
  libXau.x86_64 0:1.0.5-1.el6      
  libXpm.x86_64 0:3.5.8-2.el6 
  libjpeg.x86_64 0:6b-46.el6
  libpng.x86_64 2:1.2.49-1.el6_2  
  libxcb.x86_64 0:1.5-1.el6        

Complete!

Easy going, isn't it?

Restart Lighttpd

Restart your lighted, and you're ready to rock.
[root@srv]# service httpd restart
Stopping lighttpd:                                            [  OK ]
Starting lighttpd:                                            [  OK ]

No comments:

Post a Comment