php in free(): error: junk pointer, too high to make sense

Jim Pingle lists at
Thu Nov 23 06:49:29 PST 2006

Dominik Zalewski wrote:
> I'm using FreeBSD 6.1 release on i386. I have a problem with pear and apache. 
> Here is what I'm getting:
> [root at silicon ~]# pear list
> Installed packages, channel
> =========================================
> Package        Version State
> Archive_Tar    1.3.1   stable
> Console_Getopt 1.2     stable
> DB             1.7.6   stable
> Date           1.4.7   stable
> Log            1.9.9   stable
> PEAR           1.4.11  stable
> XML_RPC        1.5.0   stable
> php in free(): error: junk pointer, too high to make sense
> Abort trap: 6 (core dumped)
> apache 2.2.3 and php-4.4.4_1 is working fine but everytime I restart it throws 
> core dump.
> Any ideas?

I have seen this with PHP for a long time, with PHP 4.x-5.x. While it isn't
the exact same context in which you're getting the error, the source may be
the same. After I rebuild PHP extensions and restart Apache (1.3 or 2.2,
doesn't matter which) or invoke PHP from the command line, PHP crashes
and/or takes Apache down with it. Here are the errors that tend to show up
for me:

 * exited on signal 11 (core dumped)
 * exited on signal 6 (core dumped)
 * seg fault or similar nasty error detected in the parent process
 * httpd in free(): error: junk pointer, too high to make sense

I'm not sure if it's a problem inherent to how the ports system builds and
installs the extensions or if it's just a problem in general. I had read
somewhere that rebuilding extensions in a certain order would fix it.
However, after some experimenting I found that rebuilding the extensions
doesn't really matter, but the order of the extensions being loaded does.

Rebuilding fixed it because when a php extension port is rebuilt, it gets
placed at the end of extensions.ini. I solved the problem by editing
/usr/local/etc/php/extensions.ini and placing the lines for mysql, imap, and
sockets at the end and in that order:


I'm not sure if the conflict is only with those three, or with others as
well, but that fixes it on my servers. I tried it on three different setups,
and before the change they all crashed and after the change they're all
running OK.

I was never sure if I should file a PR about it because it could easily be a
PHP problem and have nothing to do with FreeBSD or the ports system
specifically. I haven't had time to research it any more to get enough
information to figure out where the problem lies and with whom the bug
report should be filed (i.e. try building directly and not from ports,
install Fedora and try there, etc)

Hope this helps! If not, it will at least be in the archives for future


More information about the freebsd-stable mailing list