Too many open files – Too many PDO connect
-
Errors install:
PHP Warning: file_put_contents(/var/www/wordpress/wp-content/database/debug.txt): failed to open stream: Too many open files in /var/www/wordpress/wp-content/plugins/sqlite-integration/pdoengine.class.php on line 1136 [Tue Sep 23 11:47:03 2014] PHP Fatal error: Call to a member function prepare() on a non-object in /var/www/wordpress/wp-content/plugins/sqlite-integration/pdoengine.class.php on line 615
Configuration:
Mac OS X 10.8.1, php 5.5, with start builtin web-server:
php -S 0.0.0.0:80 -t /var/www/wordpressFound problem: too many pdo sqlite db connect (WTF?)
Solved solution: make one global pdo object and reuse.
Patch:diff -ur /Users/User/Projects.files/tests/wordpress/sqlite-integration/pdoengine.class.php sqlite-integration/pdoengine.class.php --- /Users/User/Projects.files/tests/wordpress/sqlite-integration/pdoengine.class.php 2014-09-04 21:18:50.000000000 +0400 +++ sqlite-integration/pdoengine.class.php 2014-09-23 14:05:51.000000000 +0400 @@ -213,13 +213,14 @@ do { try { if ($locked) $locked = false; - $this->pdo = new PDO( + $this->pdo = empty($GLOBALS['PDO_SQLite']) ? new PDO( $dsn, // data source name null, // user name null, // user password array( // PDO options PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION - )); + )) : $GLOBALS['PDO_SQLite']; + $GLOBALS['PDO_SQLite'] = $this->pdo; $statement = $this->pdo->query("SELECT COUNT(*) FROM sqlite_master WHERE type='table'"); $number_of_tables = $statement->fetchColumn(0); $statement = null; @@ -254,6 +255,7 @@ $this->set_error(__LINE__, __FUNCTION__, $message); return false; } + $GLOBALS['PDO_SQLite'] = $this->pdo; $this->make_sqlite_tables(); } }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Too many open files – Too many PDO connect’ is closed to new replies.