PDO_MYSQL causes Apache to segfault on Ubuntu (I think)

Serg B. sergicles at gmail.com
Tue Dec 26 16:39:04 UTC 2006


Hi All,

I am trying to figure out if it's just my system setup or if there is
a bug in PECL PDO_MYSQL extension or Apache.

Below is the PHP code I am using, I compacted it for simplicity (tested):

//$dsn = "mysql:host=localhost;dbname=test_db;port=3306";
$dsn = "pgsql:dbname=test_db";

$username = "XXX";
$password = "XXX";

$num = 123;

$dbh = new PDO($dsn, $username, $password);
$sth = $dbh->prepare("select * from test where fld_1 > ?");
$sth->execute(array($num));

echo "<pre>";
var_dump($sth->fetchAll());

$sth->closeCursor();
//$sths->closeCursor();


Issue 1:
When this code is executed against MySQL server using PDO_MYSQL
(v1.0.2, latest stable) it refuses to correctly evaluate line:

$sth->execute(array($num));

If I hardcode the values (numbers, no marker) into the SQL query and
leave $sth->execute() argument list empty everything works as
expected.

When I supply an argument list (above) a complete data set is
returned. Not just the values that fall under the "fld_1 > 123"
condition.

This works flawlessly when run against PostgreSQL server. So I suspect
it to be the MySQL PDO extension on Ubuntu Server.

Issue 2:
$sth->closeCursor();
//$sths->closeCursor();  // This is a non-existent object

When $sth is an invalid statement object ($sths) I get a notice and an
error when I run it against a PostgreSQL server. Messages below.

Notice:  Undefined variable: sths in /home/XXX/XXX/XXX/driver.php on line 31
Fatal error:  Call to a member function closeCursor() on a non-object
in /home/XXX/XXX/XXX/driver.php on line 31

When I run the same (invalid statement object $sths) against MySQL
server Apache spits this (below) out into its error.log file.

[Wed Dec 27 17:20:58 2006] [notice] child pid 19596 exit signal
Segmentation fault (11)

System I am using is:
Ubuntu 6.06.1 LTS
2.6.15-27-server #1 SMP

Latest apt-get update and dist-upgarde updates.

Nothing has been manually compiled on/for this system with the
exclusion of the PDO extensions  listed below.

PDO Extensions compiled with/by/using the following:

export PHP_PDO_SHARED="true"
phpize
./configure
make
make install

A list of relevant packages is appended below.

Any ideas would be appreciated.

   Thank,
       Serg

PDO Extensions compiled and installed are:
PDO-1.0.3 (latest stable)
PDO_MYSQL-1.0.2 (latest stable)
PDO_PGSQL-1.0.2 (latest stable)


Relevant MySQL packages installed are:
ii  libdbd-mysql-perl            3.0002-2build1               A Perl5
database interface to the MySQL data
ii  libmysqlclient14             4.1.15-1ubuntu5              mysql
database client library
ii  libmysqlclient15-dev         5.0.22-0ubuntu6.06.2         mysql
database development files
ii  libmysqlclient15off          5.0.22-0ubuntu6.06.2         mysql
database client library
ii  mysql-client-4.1             4.1.15-1ubuntu5              mysql
database client binaries
ii  mysql-common                 5.0.22-0ubuntu6.06.2         mysql
database common files (e.g. /etc/mysql
ii  mysql-server-4.1             4.1.15-1ubuntu5              mysql
database server binaries
ii  php5-mysql                   5.1.2-1ubuntu3.4             MySQL
module for php5
ii  php5-mysqli                  5.1.2-1ubuntu3.4             MySQL
Improved module for php5


Relevant PostgreSQL packages installed are:
ii  postgresql-8.1               8.1.4-0ubuntu1.1
object-relational SQL database, version 8.1
ii  postgresql-client-8.1        8.1.4-0ubuntu1.1
front-end programs for PostgreSQL 8.1
ii  postgresql-client-common     53ubuntu3                    manager
for multiple PostgreSQL client versi
ii  postgresql-common            53ubuntu3                    manager
for PostgreSQL database clusters
ii  postgresql-dev               7.5.16.1
development files for libpq (transitional pa
ii  postgresql-server-dev-8.1    8.1.4-0ubuntu1.1
development files for PostgreSQL 8.1 server-


Relevant Apache packages installed are:
ii  apache2                      2.0.55-4ubuntu2.1            next
generation, scalable, extendable web se
ii  apache2-common               2.0.55-4ubuntu2.1            next
generation, scalable, extendable web se
ii  apache2-mpm-prefork          2.0.55-4ubuntu2.1
traditional model for Apache2
ii  apache2-utils                2.0.55-4ubuntu2.1            utility
programs for webservers
ii  exim4                        4.60-3ubuntu3.1
metapackage to ease exim MTA (v4) installati
ii  libapache2-mod-perl2         2.0.2-2ubuntu1
Integration of perl with the Apache2 web ser
ii  libapache2-mod-php5          5.1.2-1ubuntu3.4
server-side, HTML-embedded scripting languag
ii  libapr0                      2.0.55-4ubuntu2.1            the
Apache Portable Runtime
ii  libcap1                      1.10-14                      support
for getting/setting POSIX.1e capabil


Relevant PHP packages installed are:
ii  libapache2-mod-php5          5.1.2-1ubuntu3.4
server-side, HTML-embedded scripting languag
ii  php-pear                     5.1.2-1ubuntu3.4             PEAR -
PHP Extension and Application Reposit
ii  php5                         5.1.2-1ubuntu3.4
server-side, HTML-embedded scripting languag
ii  php5-cli                     5.1.2-1ubuntu3.4
command-line interpreter for the php5 script
ii  php5-common                  5.1.2-1ubuntu3.4             Common
files for packages built from the php
ii  php5-curl                    5.1.2-1ubuntu3.4             CURL
module for php5
ii  php5-dev                     5.1.2-1ubuntu3.4             Files
for PHP5 module development
ii  php5-gd                      5.1.2-1ubuntu3.4             GD
module for php5
ii  php5-imap                    5.1.2-1                      IMAP
module for php5
ii  php5-json                    1.1.0-2                      JSON
serialiser for PHP5
ii  php5-ldap                    5.1.2-1ubuntu3.4             LDAP
module for php5
ii  php5-mcrypt                  5.1.2-1                      MCrypt
module for php5
ii  php5-mhash                   5.1.2-1ubuntu3.4             MHASH
module for php5
ii  php5-mysql                   5.1.2-1ubuntu3.4             MySQL
module for php5
ii  php5-mysqli                  5.1.2-1ubuntu3.4             MySQL
Improved module for php5
ii  php5-odbc                    5.1.2-1ubuntu3.4             ODBC
module for php5
ii  php5-pgsql                   5.1.2-1ubuntu3.4
PostgreSQL module for php5
ii  php5-pspell                  5.1.2-1                      pspell
module for php5
ii  php5-recode                  5.1.2-1ubuntu3.4             recode
module for php5
ii  php5-snmp                    5.1.2-1ubuntu3.4             SNMP
module for php5
ii  php5-sqlite                  5.1.2-1ubuntu3.4             SQLite
module for php5
ii  php5-sybase                  5.1.2-1ubuntu3.4             Sybase /
MS SQL Server module for php5
ii  php5-xmlrpc                  5.1.2-1ubuntu3.4             XML-RPC
module for php5
ii  php5-xsl                     5.1.2-1ubuntu3.4             XSL
module for php5




More information about the ubuntu-users mailing list