Friday 17 October 2014

Install GD library and freetype on Linux

Installing GD :

For CentOS / RedHat / Fedora :
sudo yum install php-gd
For Debian/ubuntu :
sudo apt-get install php5-gd

Installing freetype :

For CentOS / RedHat / Fedora :
sudo yum install freetype
For Debian/ubuntu :
sudo apt-get install freetype*
 
 
 

Ubuntu Linux: Install or Add PHP-GD Support To Apache Web Server

 

# apt-get install php5-gd
OR
$ sudo apt-get install php5-gd
Sample outputs (from my Debian server)
apt-get install php5-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libgd2-xpm
Suggested packages:
  libgd-tools
The following packages will be REMOVED:
  libgd2-noxpm
The following NEW packages will be installed:
  libgd2-xpm php5-gd
0 upgraded, 2 newly installed, 1 to remove and 7 not upgraded.
Need to get 270 kB of archives.
After this operation, 176 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://debian.osuosl.org/debian/ squeeze/main libgd2-xpm amd64 2.0.36~rc1~dfsg-5 [231 kB]
Get:2 http://security.debian.org/ squeeze/updates/main php5-gd amd64 5.3.3-7+squeeze9 [39.1 kB]
Fetched 270 kB in 2s (124 kB/s)
dpkg: libgd2-noxpm: dependency problems, but removing anyway as you requested:
 libgvc5 depends on libgd2-noxpm (>= 2.0.36~rc1~dfsg) | libgd2-xpm (>= 2.0.36~rc1~dfsg); however:
  Package libgd2-noxpm is to be removed.
  Package libgd2-xpm is not installed.
(Reading database ... 206928 files and directories currently installed.)
Removing libgd2-noxpm ...
Selecting previously deselected package libgd2-xpm.
(Reading database ... 206919 files and directories currently installed.)
Unpacking libgd2-xpm (from .../libgd2-xpm_2.0.36~rc1~dfsg-5_amd64.deb) ...
Setting up libgd2-xpm (2.0.36~rc1~dfsg-5) ...
Selecting previously deselected package php5-gd.
(Reading database ... 206930 files and directories currently installed.)
Unpacking php5-gd (from .../php5-gd_5.3.3-7+squeeze9_amd64.deb) ...
Processing triggers for libapache2-mod-php5 ...
Reloading web server config: apache2.
Setting up php5-gd (5.3.3-7+squeeze9) ...
Finally, restart the Apache 2 web serer, enter:
# /etc/init.d/apache2 restart
You can test your php application.

How do I verify that php5-gd support loaded or not?

Type the following command:
$ php5 -m | grep -i gd
Sample outputs:
gd
OR
$ php5 -i | grep -i --color gd
OR
$ php -i | grep -i --color gd
Sample outputs:
Additional .ini files parsed => /etc/php5/cli/conf.d/gd.ini,
gd
GD Support => enabled
GD Version => 2.0
gd.jpeg_ignore_warning => 0 => 0
XAUTHORITY => /var/run/gdm3/auth-for-vivek-ruJHl1/database
_SERVER["XAUTHORITY"] => /var/run/gdm3/auth-for-vivek-ruJHl1/database
You can also use the following php code. Create a file called test.php and put in your web server directory i.e. Apache DocumentRoot (such as /var/www):
 
<?php
  phpinfo();
?>
 
Run it as follows:
http://your-server-ip/test.php AND ADD EXTENSION IN PHP.INIextension = gd.so

 

No comments:

Post a Comment