ID:               36208
 Updated by:       [EMAIL PROTECTED]
 Reported By:      hb at gentoo dot x256 dot org
-Status:           Open
+Status:           Wont fix
 Bug Type:         Dynamic loading
 Operating System: Gentoo Linux x86
 PHP Version:      5.1.2
 New Comment:

In case when you need to compile another apache module that uses gdlib
you need to compile php with the system library.
(--with-gd=/path/to/system/gdlib)


Previous Comments:
------------------------------------------------------------------------

[2006-01-30 12:45:16] hb at gentoo dot x256 dot org

Description:
------------
PHP includes a tweaked GD library. It is not compatible with libgd. The
problem is, it uses the same symbols (i.e. function names) as libgd and
exports them from its shared object. When I load mod_php and mod_perl
into Apache, mod_perl programs using the GD library end up sometimes
calling PHP's modified GD routines and sometimes not. This causes
Apache children to crash semi-randomly.

Since the PHP GD library is not compatible with libgd itself (and
because it's likely to be co-existing with a different version of libgd
on the system, regardless of tweaks), the symbols (functions and others)
should be renamed. Perhaps with a PHP_ prefix. This way there will be no
dynamic loading collision and PHP/PERL will be able to co-exist in
Apache children without damage.

I worked around this by recompiling libPHP with external GD library
support. However, it took me several hours to diagnose the exact
problem. I have also been bitten by this once before already.

I recommend fixing this in PHP4 as well as PHP5.


Reproduce code:
---------------
This PERL/MASON script crashes every time if libphp5.so is loaded as an
Apache module, but works perfectly otherwise:

<%INIT>
use strict;
use GD::Graph::lines;

my $tgraph = GD::Graph::lines->new(800, 800);
my $tgd = $tgraph->plot([ [ "a" ], [ 0 ] ]);
print $tgd->png();
return;
</%INIT>


Expected result:
----------------
Blank graph.

Actual result:
--------------
Zero-sized reply. GLIBC memory corruption reported upon free() in
error_log.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36208&edit=1

Reply via email to