[php-maint] Bug#336275: Function mysql_fetch_field crashes Apache [package php4-mysql (stable) 4:4.3.10-16_i386]

Adrian Caneva adrian.caneva at gmail.com
Sat Oct 29 05:14:54 UTC 2005

Package: php4-mysql
Status: install ok installed
Priority: optional
Section: web
Installed-Size: 112
Maintainer: Adam Conrad <adconrad at 0c3.net>
Source: php4
Version: 4:4.3.10-16
Replaces: php4-cgi-mysql
Depends: libc6 (>= 2.3.2.ds1-21), libmysqlclient12, debconf (>= 0.5) |
debconf-2.0, phpapi-20020918, php4-common (= 4:4.3.10-16)
Description: MySQL module for php4
 This package provides a module for MySQL database connections directly from
 PHP scripts.
 PHP4 is an HTML-embedded scripting language. Much of its syntax is borrowed
 from C, Java and Perl with a couple of unique PHP-specific features thrown
 in. The goal of the language is to allow web developers to write
 dynamically generated pages quickly.



Under apache-ssl (1.3.33-6sarge1, more info on package versions below):

a) PhpMyAdmin Version: 4:2.6.2-3  won´t browse tables (Browse Tab
after tables are selected)
b) Wordpress Version: 1.5.2 would show blank pages (<html><body></body></html>)

- Apache won´t log HTTP requests/access from php scripts including
mysql_fetch_field calls
- But MySQL logs their sql queries
- No /var/log/messages, syslog, etc errors are shown
- No PHP errors logged

Apache crashes when @mysql_fetch_fields() function is called into a php script.

TEST CODE test.php
$conn = mysql_connect('localhost:3306', 'user', 'pass');
$result = mysql_query('select * from table');
/* get column metadata */
$i = 0;
while ($i < mysql_num_fields($result)) {
   echo "Information for column $i:<br />\n";
      $meta = mysql_fetch_field($result, $i);

I've extracted mysql.so from package :


And replaced


Restarting apache, the problem was solved.

ALSO tried
Downloading sources php4-mysql (latest source 4.3.10-15) and compiling
(buildpackage). mysql.so obtained had the same trouble as the binary
included with php4-mysql (4.3.10-16)

Linux 2.6.8-1-686

RELATED Packages Installed
php4           4.3.10-16      server-side, HTML-embedded scripting languag
php4-cgi       4.3.4-4        A server-side, HTML-embedded scripting langu
php4-cli       4.3.10-16      command-line interpreter for the php4 script
php4-common    4.3.10-16      Common files for packages built from the php
php4-gd        4.3.10-16      GD module for php4
php4-mhash     4.3.10-16      MHASH module for php4
php4-mysql     4.3.10-16      MySQL module for php4
php4-pear      4.3.10-16      PEAR - PHP Extension and Application Reposit

apache-common  1.3.33-6sarge1 support files for all Apache webservers
apache-dev     1.3.33-6sarge1 development kit for the Apache webserver
apache-ssl     1.3.33-6sarge1 versatile, high-performance HTTP server with
apache-utils   1.3.31-7       Utility programs for webservers
apache2-common 2.0.54-5       next generation, scalable, extendable web se
apache2-prefor 2.0.54-5       development headers for apache2
apache2-utils  2.0.54-5       utility programs for webservers
libapache-mod- 4.3.8-1        Apache module for MySQL authentication
libapache-mod- 1.0.3-10       A DAV module for Apache
libapache-mod- 0.0.20021209-6 Apache module for non-ascii filename interop
libapache-mod- 4.3.10-16      server-side, HTML-embedded scripting languag
libiconv-hook1 0.0.20021209-6 extension of iconv for libapache-mod-encodin

libc6          2.3.2.ds1-22   GNU C Library: Shared libraries and Timezone
libc6-dev      2.3.2.ds1-22   GNU C Library: Development Libraries and Hea

libmysqlclient 4.0.24-10sarge mysql database client library
libmysqlclient 4.1.11a-4sarge mysql database client library
mysql-client-4 4.1.11a-4sarge mysql database client binaries
mysql-common-4 4.1.11a-4sarge mysql database common files (e.g. /etc/mysql
mysql-server-4 4.1.11a-4sarge mysql database server binaries

phpmyadmin         2.6.2-3            set of PHP-scripts to
administrate MySQL over the WW

Thanks, hope that this info can help.

More information about the pkg-php-maint mailing list