• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

How do I add GD to my LAMP server? (dummy-level answer please!)

I have a dedicated virtual LAMP server.

PHP Version 5.2.4-2ubuntu5.9

It lacks the GD library.  I do have root access, but I'm not sure I want to recompile PHP.

http://www.php.net/manual/en/image.installation.php is confusing me ... makes me think I need to recompile.  Is that true?  I just REALLY don't want to hose my entire PHP installation.

Thanks!
0
Daniel Wilson
Asked:
Daniel Wilson
  • 4
  • 3
  • 2
3 Solutions
 
Ray PaseurCommented:
Please read the man page here:
http://us2.php.net/manual/en/image.setup.php
0
 
Ray PaseurCommented:
The requirements are listed here:
http://us2.php.net/manual/en/image.requirements.php

Installation is detailed here:
http://us2.php.net/manual/en/image.installation.php

Runtime considerations are available here (note comments about memory):
http://us2.php.net/manual/en/image.configuration.php

Here is a function that will tell you if your GD is at the current level...

HTH, ~Ray
// A FUNCTION TO DETERMINE IF GD IS AT LEVEL 2 OR MORE
function get_gd_info($display=FALSE)
{

// IS GD INSTALLED AT ALL?
   if (!function_exists("gd_info"))
   {
      if ($display) echo "<br/>GD NOT INSTALLED\n";
      return FALSE;
   }

// IF GD IS INSTALLED GET DETAILS
   $gd = gd_info();

// IF DISPLAY IS REQUESTED, PRINT DETAILS
   if ($display)
   {
      echo "<br/>GD DETAILS:\n";
      foreach ($gd as $key => $value)
      {
         if ($value === TRUE)  $value = 'YES';
         if ($value === FALSE) $value = 'NO';
         echo "<br/>$key = $value \n";
      }
   }

// RETURN THE VERSION NUMBER
   $gd_version = ereg_replace('[^0-9\.]', '', $gd["GD Version"]);;
   return $gd_version;
}

Open in new window

0
 
Daniel WilsonAuthor Commented:
Thanks, Ray.

It says:
GD NOT INSTALLED

Which I'd suspected since phpinfo() didn't say anything about it.

So ... for my step-by-step, I would:
1. Download both the PNG and JPG libraries linked from the requirements page
2. "configure PHP --with-gd[=DIR]"

where do I type that phrase?  In a config file somewhere?  surely not just in my PuTTY session?

As you've suspected, Linux configuration is not my cup of tea ... so thanks for your patient help!
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
marmata75Commented:
Hi Daniel,

you're probably using php precompiled from the ubuntu repositories. To prove that do this from a command line:

dpkg -l | grep php

you should have a list of packages installed. If this is the case, to install gd you just need to write:

sudo apt-get install php5-gd

to have the gd extension installed!

Cheers,
]\/[arco
0
 
Daniel WilsonAuthor Commented:
Thanks, Marmata75.  that appeared to work ... but ... Ray's GD detection script still says GD NOT INSTALLED and my graphs still don't work.  And phpinfo still does not list GD.

Did I do something wrong?

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  defoma fontconfig-config libfontconfig1 libfreetype6 libgd2-xpm libjpeg62
  libpng12-0 libt1-5 libxpm4 ttf-dejavu ttf-dejavu-core ttf-dejavu-extra
Suggested packages:
  defoma-doc dfontmgr psfontmgr x-ttcidfont-conf libfreetype6-dev libgd-tools
Recommended packages:
  libft-perl
The following NEW packages will be installed:
  defoma fontconfig-config libfontconfig1 libfreetype6 libgd2-xpm libjpeg62
  libpng12-0 libt1-5 libxpm4 php5-gd ttf-dejavu ttf-dejavu-core
  ttf-dejavu-extra
0 upgraded, 13 newly installed, 0 to remove and 1 not upgraded.
Need to get 5761kB of archives.
After this operation, 12.1MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://us.archive.ubuntu.com hardy/main defoma 0.11.10-0.2 [101kB]
Get:2 http://us.archive.ubuntu.com hardy/main ttf-dejavu-core 2.23-1 [1347kB]
Get:3 http://us.archive.ubuntu.com hardy/main ttf-dejavu-extra 2.23-1 [2885kB]
Get:4 http://us.archive.ubuntu.com hardy/main ttf-dejavu 2.23-1 [3102B]
Get:5 http://us.archive.ubuntu.com hardy/main fontconfig-config 2.5.0-2ubuntu3 [182kB]
Get:6 http://us.archive.ubuntu.com hardy-updates/main libfreetype6 2.3.5-1ubuntu4.8.04.2 [347kB]
Get:7 http://us.archive.ubuntu.com hardy/main libfontconfig1 2.5.0-2ubuntu3 [89.4kB]
Get:8 http://us.archive.ubuntu.com hardy/main libjpeg62 6b-14 [86.5kB]
Get:9 http://us.archive.ubuntu.com hardy-updates/main libpng12-0 1.2.15~beta5-3ubuntu0.1 [189kB]
Get:10 http://us.archive.ubuntu.com hardy/main libxpm4 1:3.5.7-1 [41.4kB]
Get:11 http://us.archive.ubuntu.com hardy-updates/main libgd2-xpm 2.0.35.dfsg-3ubuntu2.1 [321kB]
Get:12 http://us.archive.ubuntu.com hardy/main libt1-5 5.1.1-5 [137kB]
Get:13 http://us.archive.ubuntu.com hardy-updates/main php5-gd 5.2.4-2ubuntu5.9 [32.9kB]
Fetched 5761kB in 18s (316kB/s)
Preconfiguring packages ...
Selecting previously deselected package defoma.
(Reading database ... 50490 files and directories currently installed.)
Unpacking defoma (from .../defoma_0.11.10-0.2_all.deb) ...
Selecting previously deselected package ttf-dejavu-core.
Unpacking ttf-dejavu-core (from .../ttf-dejavu-core_2.23-1_all.deb) ...
Selecting previously deselected package ttf-dejavu-extra.
Unpacking ttf-dejavu-extra (from .../ttf-dejavu-extra_2.23-1_all.deb) ...
Selecting previously deselected package ttf-dejavu.
Unpacking ttf-dejavu (from .../ttf-dejavu_2.23-1_all.deb) ...
Selecting previously deselected package fontconfig-config.
Unpacking fontconfig-config (from .../fontconfig-config_2.5.0-2ubuntu3_all.deb) ...
Selecting previously deselected package libfreetype6.
Unpacking libfreetype6 (from .../libfreetype6_2.3.5-1ubuntu4.8.04.2_i386.deb) ...
Selecting previously deselected package libfontconfig1.
Unpacking libfontconfig1 (from .../libfontconfig1_2.5.0-2ubuntu3_i386.deb) ...
Selecting previously deselected package libjpeg62.
Unpacking libjpeg62 (from .../libjpeg62_6b-14_i386.deb) ...
Selecting previously deselected package libpng12-0.
Unpacking libpng12-0 (from .../libpng12-0_1.2.15~beta5-3ubuntu0.1_i386.deb) ...
Selecting previously deselected package libxpm4.
Unpacking libxpm4 (from .../libxpm4_1%3a3.5.7-1_i386.deb) ...
Selecting previously deselected package libgd2-xpm.
Unpacking libgd2-xpm (from .../libgd2-xpm_2.0.35.dfsg-3ubuntu2.1_i386.deb) ...
Selecting previously deselected package libt1-5.
Unpacking libt1-5 (from .../libt1-5_5.1.1-5_i386.deb) ...
Selecting previously deselected package php5-gd.
Unpacking php5-gd (from .../php5-gd_5.2.4-2ubuntu5.9_i386.deb) ...
Setting up defoma (0.11.10-0.2) ...

Setting up ttf-dejavu-core (2.23-1) ...

Setting up ttf-dejavu-extra (2.23-1) ...

Setting up ttf-dejavu (2.23-1) ...
Setting up fontconfig-config (2.5.0-2ubuntu3) ...

Setting up libfreetype6 (2.3.5-1ubuntu4.8.04.2) ...

Setting up libfontconfig1 (2.5.0-2ubuntu3) ...

Setting up libjpeg62 (6b-14) ...

Setting up libpng12-0 (1.2.15~beta5-3ubuntu0.1) ...

Setting up libxpm4 (1:3.5.7-1) ...

Setting up libgd2-xpm (2.0.35.dfsg-3ubuntu2.1) ...

Setting up libt1-5 (5.1.1-5) ...

Setting up php5-gd (5.2.4-2ubuntu5.9) ...

Processing triggers for libc6 ...
ldconfig deferred processing now taking place

Open in new window

0
 
marmata75Commented:
Hi Daniel,

sorry forgot to say you should restart apache to have the new extension properly recognized. Can you just type "sudo apache2ctl restart" at the command prompt, and verify if it's working now?

Thanks,
]\/[arco
0
 
Daniel WilsonAuthor Commented:
I restarted but got errors ... apache is running again, but still w/o GD


dwilson@williamston:/etc/init.d$ /etc/init.d/apache2  restart
 * Restarting web server apache2                                                [Mon Jan 04 07:36:58 2010] [warn] NameVirtualHost *:443 has no VirtualHosts
httpd (pid 18002?) not running
[Mon Jan 04 07:37:08 2010] [warn] NameVirtualHost *:443 has no VirtualHosts
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

Open in new window

0
 
marmata75Commented:
Hi Daniel,

I think the command failed because you tried to restart apache as a normal user. You should use sudo or login as root to properly restart it. Basically it's not restarted in any way.
Please do a full shut down and restart with the following commands:

sudo /etc/init.d/apache2 stop
<wait for apache to stop>
sudo /etc/init.d/apache2 start

If you still have errors, something else is wrong with your config and we'll need to dig it deeper!

Cheers,
]\/[arco
0
 
Daniel WilsonAuthor Commented:
Awesome.  Thanks!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now