[wp-trac] [WordPress Trac] #31018: Persistent database connections with mysqli

WordPress Trac noreply at wordpress.org
Thu Jan 15 15:53:30 UTC 2015

#31018: Persistent database connections with mysqli
 Reporter:  blobaugh                             |       Owner:
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Database                             |  Review
 Severity:  normal                               |     Version:  trunk
 Keywords:  has-patch needs-testing dev-         |  Resolution:
  feedback                                       |     Focuses:

Comment (by blobaugh):

 Replying to [comment:3 pento]:
 > * We ''really'' don't want to add new `wp-config.php` settings,
 especially for something as edge case as this.

 Could you explain why this is? It seems new settings are warranted as
 there is no other way to modify how the database connection works.

 > * Persistent connections sound like a really good idea, but have bunch
 of gotchas that most users won't be aware of, or know how to mitigate. We
 don't want to encourage users to do things that will break their site, and
 persistent connections will do that in fairly obscure ways.

 Uh huh, so does setting DB_HOST or DB_CHARSET or WP_CONTENT_DIR or any
 number of other settings. They can all break a user's site. That is why
 they are in the settings file and not exposed in the UI for users to play
 with. That argument does not seem to stand up to the test of other

 > For situations like this, I'd recommend creating a DB drop-in that
 replaces `wpdb::db_connect()` with a persistent version.

 Yes this is one option, however it is not a good option because core
 changes how connections work periodically. The site owner would need to be
 aware that core was changing so they could hire a dev to update their
 drop-in file. It is not realistic for a site owner to track that. They
 should only have to enjoy their site. We are already seeing many instances
 of this happening with IIS based installs. The plugin jtsternberg
 mentioned goes to some length to capture this but is ultimately a bad hack
 and very fragile but it is currently how I have seen adding persistent
 connections to WordPress recommended (though I do agree it is horrible).

Ticket URL: <https://core.trac.wordpress.org/ticket/31018#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list