PHP is used mainly in server-side application software along with various addons.
The GD Graphics Library for dynamically manipulating images. You will need to compile PHP with the GD library of image functions for this to work. However. Ubuntu (and Debian) Linux comes with the package called php5-gd. Just type the following command to install this module:
# apt-get install php5-gd
$ 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 server, enter:
# /etc/init.d/apache2 restart
Now, you can test your php application.
How do I verify that php5-gd support loaded or not?
Type the following command at a shell prompt:
$ php5 -m | grep -i gd
$ php5 -i | grep -i --color gd
$ php -i | grep -i --color gd
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:
Look for GD extension.
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop