2

I'm aware there's already a post with the same title, but my question is different: as I explain it in a Stack Overflow post, I need to use a more recent version of php-gd in my 12.04 Ubuntu than the one shipped by apt-get, and as my system skills are kind of poor, I don't know how to do that (I think I need to somehow modify my packages repositories, but... well I don't know how).

To be clear, in my OSX dev machine, I have a "bundled (2.1.0 compatible)" GD version, with a 1.6.2 libPNG version. And in my Ubuntu prod server, I'm stuck with GD 2.0.36 (see php-info). Can I upgrade this, and how?

By the way, the reason of this is explained in the Stack overflow post linked at the top: I have a huge quality difference in PNG resizing, and it seems GD is the cause of it.

Thanks a lot.

Philippe
  • 123
  • 3

1 Answers1

0

First, You have to follow this question and install your needed version of PHP that supports GD version 2.1.0

then you can install your needed GD version accordingly

 sudo apt-get install php5-gd

NOTE: php5.4 isn't compatible with GD>=2.1.0

I got this from this question although it seems he has installed both GDs in the same machine

libgd2-xpm                                   
2.0.36~rc1~dfsg-6ubuntu2                GD Graphics Library version 2 ii  libgd2-xpm:i386                              
2.0.36~rc1~dfsg-6ubuntu2                GD Graphics Library version 2 ii  libgd3                                        
2.1.0-2~precise+1    GD Graphics Library       php5-gd                                      
5.4.17-4+debphp.org~precise+1           GD module for php5
kamil
  • 7,355
  • 7
  • 40
  • 61
  • thanks for your answer. Thing is I already have PHP 5.4.25 (see php-info link, in the post), which is I believe that last stable version (at least, the last version I can use with Apache 2.2). On OSX, I have PHP 5.4.19 with a more recent version of php-gd... I found here a similar thread, and the solution was to change (I believe) the way to build PHP? – Philippe Feb 17 '14 at 14:13
  • @Philippe if you visit the repo https://launchpad.net/~ondrej/+archive/php5 you will find that gd library is version 2.1 so assuming you will follow the question stated in my answer you can solve your problem for newer version of php and gd. The key in that question is to update into an up to date repository and then you will find your needed version of gd. – kamil Feb 17 '14 at 17:21
  • I can't install php 5.5, because it depends on Apache 2.4, and I have to stick on Apache 2.2 for now. So I want php 5.4 with GD 2.1, and it's possible, at least on my OSX dev machine. I tried your solution, configuring the [https://launchpad.net/~ondrej/+archive/php5-oldstable] (ppa:ondrej/php5-oldstable) PPA, like it's written at the end of the post, to keep PHP 5.4, but after a long upgrade I'm still on the 2.0.36 version of GD... – Philippe Feb 18 '14 at 08:27
  • gd 2.1 is not compatible with php 5.4. Look here:http://askubuntu.com/a/329286/182026 – kamil Feb 18 '14 at 09:22
  • OK, I thought it was possible because I have this configuration on my OSX dev machine (PHP 5.4.19 + GD 2.1), but maybe there are some hidden bugs. Looks like I've got to look for another solution, either upgrade PHP and Apache, or modify my thumbnail code... Thanks a lot, anyway, I mark your first answer as accepted! – Philippe Feb 18 '14 at 14:07