php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38886 PDO fails for no apparent reason, pages that works randomly breaks
Submitted: 2006-09-19 20:54 UTC Modified: 2010-12-20 12:19 UTC
Votes:6
Avg. Score:4.2 ± 1.2
Reproduced:6 of 6 (100.0%)
Same Version:4 (66.7%)
Same OS:4 (66.7%)
From: tg at idiom dot dk Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.1.6 OS: Linux 2.6.12.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
11 - 7 = ?
Subscribe to this entry?

 
 [2006-09-19 20:54 UTC] tg at idiom dot dk
Description:
------------
I run an Apache (2.0.58) server, PDO (1.0RC2) and APC (3.0.11).
My PDO randomly gives me this error (Fatal error: Call to a member function execute() on a non-object in /var/www/*/htdocs/classes/pdoMysql.class.php on line 33
), without any errors in the log.
The error occurs more frequently when the server is loading, but it also happens with no particular load, and some seconds after it works flawless again.
I've tried the latest CVS snapshop for PHP 5, but it didn't fix the problem.

PHP configure flags:
'./configure' '--prefix=/usr/lib/php5' '--host=i686-pc-linux-gnu' '--mandir=/usr/lib/php5/man' '--infodir=/usr/lib/php5/info' '--sysconfdir=/etc' '--cache-file=./config.cache' '--disable-cli' '--with-apxs2=/usr/sbin/apxs2' '--with-config-file-path=/etc/php/apache2-php5' '--with-config-file-scan-dir=/etc/php/apache2-php5/ext-active' '--without-pear' '--disable-bcmath' '--without-bz2' '--disable-calendar' '--disable-ctype' '--without-curl' '--without-curlwrappers' '--disable-dbase' '--disable-exif' '--without-fbsql' '--without-fdftk' '--disable-filepro' '--disable-ftp' '--with-gettext' '--without-gmp' '--disable-hash' '--without-hwapi' '--without-iconv' '--without-informix' '--disable-ipv6' '--without-kerberos' '--disable-mbstring' '--with-mcrypt' '--disable-memory-limit' '--without-mhash' '--without-ming' '--without-msql' '--without-mssql' '--with-ncurses' '--with-openssl' '--with-openssl-dir=/usr' '--disable-pcntl' '--without-pgsql' '--disable-posix' '--with-pspell' '--without-recode' '--disable-simplexml' '--disable-shmop' '--without-snmp' '--disable-soap' '--disable-sockets' '--without-sybase' '--without-sybase-ct' '--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm' '--without-tidy' '--disable-tokenizer' '--disable-wddx' '--disable-xmlreader' '--disable-xmlwriter' '--without-xmlrpc' '--without-xsl' '--with-zlib' '--disable-debug' '--enable-dba' '--without-cdb' '--without-db4' '--without-flatfile' '--with-gdbm' '--without-inifile' '--without-qdbm' '--with-freetype-dir=/usr' '--with-t1lib=/usr' '--disable-gd-jis-conv' '--enable-gd-native-ttf' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--without-xpm-dir' '--with-gd' '--with-imap' '--with-imap-ssl' '--with-ldap' '--with-ldap-sasl' '--with-mysql=/usr/lib/mysql' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--without-mysqli' '--without-pdo-dblib' '--with-pdo-mysql=/usr' '--without-pdo-odbc' '--without-pdo-pgsql' '--without-pdo-sqlite' '--with-readline' '--without-libedit' '--without-mm' '--without-sqlite'

Reproduce code:
---------------
#Snip:
$this->cfg = array(
'db'      => 'mysql',
'db_user' => '*',
'db_pwd'  => '*',
'db_host' => 'localhost',
'db_db'   => '*',
'db_opts' => array(
PDO::ERRMODE_SILENT => true,
PDO::ATTR_PERSISTENT => true,
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
)
);
$this->pdo = new PDO($this->cfg['db'].':host='.$this->cfg['db_host'].';dbname='.$this->cfg['db_db'],$this->cfg['db_user'],$this->cfg['db_pwd'],$this->cfg['db_opts']);

$stmt = $this->pdo->prepare("SELECT * FROM users");
$stmt->execute();

Expected result:
----------------
An array of info

Actual result:
--------------
Fatal error: Call to a member function execute() on a non-object in /var/www/*/htdocs/classes/pdoMysql.class.php on line 33


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-23 11:33 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-09-25 08:12 UTC] mail at 0x002a dot dk
Been there. The only fix i could find that worked was to disable the persistent connection argument.
 [2006-10-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-12-20 12:19 UTC] jani@php.net
-Package: Tidy +Package: PDO related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 23:01:30 2024 UTC