php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17664 Compiling with GD > 1.6 cause GIF problems
Submitted: 2002-06-09 06:54 UTC Modified: 2002-06-11 02:40 UTC
From: davey at its-explosive dot net Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.2.1 OS: *nix
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: davey at its-explosive dot net
New email:
PHP Version: OS:

 

 [2002-06-09 06:54 UTC] davey at its-explosive dot net
When you compile PHP  with a higher GD that 1.6 you get errors, these are a result because of the fact that PHP still tries to setup for gif support which isn't there. A botched fix this is to comment out offending lines in gd.c, however a better fix would be for someone who knows more C than me to write in version checking (if possible) and just not run the GIF setup stuff... I would also imagine that if you are using 1.6 the PNG stuff would return errors a similar "fix" would work here too.

This also works on 4.2.0 as gd.c is unchanged as far as I can tell... (please correct me if I am wrong..)

You can find my hacked up gd.c at http://www.its-explosive.net/~davey/gd.c.works 

You can view my phpinfo() here http://www.its-explosive.net/~davey/info.php 

You can also see GD in action here:
http://www.its-explosive.net/~davey/gd.test.php?do=jpg
and
http://www.its-explosive.net/~davey/gd.test.php?do=png
source:
http://www.its-explosive.net/~davey/gd.test.php?do=src

just to prove it works...

So you know, I used this fix on both 4.2.0 and now 4.2.1 on FreeBSD 4.4-R with the latest Apache 1.3.x, but you can see all that info in the phpinfo() :)

If the PHP dev team (or anyone else) would like to see my .c file and see if they could actually clean out the .gif stuff altogether (as I heard Rasmus say it's impossible to check between 1.6 and later till 2.x) and supply two gd.c's like gd.gif.c and gd.c and then you call --enable-gif to use the .gif one instead of the gd.c one? something like that...

Put simply... this is a bad fix that *does* work. I've heard alot of people complain about GD and this is the reason.


- Davey

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-09 07:06 UTC] rasmus@php.net
This makes very little sense.  The Gif stuff will only be enabled if the libgd that PHP finds contains the Gif functions.  Read the config.m4 file to see the checks.  If it is getting enabled for you, it probably means that you have a libgd.[a|so] version 1.3 or older floating around on your system and that is what PHP is finding.
 [2002-06-09 07:23 UTC] davey at its-explosive dot net
So you know the changes I made:
http://www.its-explosive.net/~davey/gd.diff.php
 [2002-06-09 07:26 UTC] davey at its-explosive dot net
Rasmus:
What if people have that library (libgd.[a|so] version 1.3) for other uses? I'm sure people do, although I don't know what other uses it has personally as I don't use it for anything else that I know of, I'm sure there is more that using it with PHP, thats something you need to cater for IMO... perhaps I'm way outta line, I don't know. 

Nice fast response ... I like it :)

- Davey
 [2002-06-09 07:56 UTC] rasmus@php.net
Well, your patch still makes no sense.  gd-1.6 and higher can still have gif support via the patches you can find at http://www.rime.com.au/gd/gd.html so simply disabling it is a very bad idea.
 [2002-06-09 08:38 UTC] davey at its-explosive dot net
1.6 supports GIF but no PNG according to php.net/image. it's >1.6 thats the problem. And why should people have to patch other software for PHP to work with them? surely PHP should work with the default config and have problems with the patched ones (or none at all as you state)? As is usually the case with most things. Heh

- Davey
 [2002-06-09 08:39 UTC] davey at its-explosive dot net
oh and as I said, it's not a patch, it's just a bad fix that works... a proper patch should be made by someone with more C  knowledge IMO.
 [2002-06-09 08:54 UTC] rasmus@php.net
You are still not making any sense.  This is not something that can really be fixed.  If people install a version of libgd which is on the default link path, then this library is going to be checked at configure time unless we go out of our way to disable the link path (which would break many other things).  It is a clear user error that the user should fix.  It is sort of like installing a different libc in your home directory and then complaining that PHP is finding the system-level libc instead of yours.  If you want to upgrade libc, do so.  Similarly, if you want to upgrade your libgd, do so.  Don't just toss multiple versions on your machine.
 [2002-06-09 13:02 UTC] davey at its-explosive dot net
Rasmus: I've checked, we only have libgd.[so|a] 1.8.4 on our server, this only support .jp(e?)g and .png, in which case the .gif support of gd.c is surplus to requirement, yet make still tries to "install" it and make then errors and fails... can you explain why that should happen and why it should be upto the user to sort it out when they are using the default libgd file? 

- Davey
 [2002-06-09 13:12 UTC] sniper@php.net
What does 'nm libgd.a | grep Gif' output?
What does 'cat main/php_config.h | grep GIF' output?

What makes you sure the version of both of those libraries
is 1.8.4? And are you 100% sure there aren't any patches applied to them which enable gif suppport? Did you get the
sources from where? Did you compile it yourself?

AFAIK, by default, GD 1.8.4 is installed as static (.a), not .so so where did that libgd.so come from?

 [2002-06-09 23:17 UTC] davey at its-explosive dot net
You would be correct, I removed libgd.so, make clean, ./configure again, and once again make failed... perhaps I am missing something? I'm not Linux god... as you may well have noticed ;)

- Davey
 [2002-06-11 02:08 UTC] rasmus@php.net
Did you remove config.cache before re-running ./configure?
 [2002-06-11 02:32 UTC] davey at its-explosive dot net
not by hand no, I would have assumed that make clean would have done all of that, let me try now.

- Davey
 [2002-06-11 02:40 UTC] davey at its-explosive dot net
Well... nice job rasmus :)

You were correct in your assumption that config.cache was the problem, I just did a complete new compile from ./configure to make install and it works perfectly :)

Sorry for wasting your time...

- Davey
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 06:01:29 2024 UTC