3

I see that in all civicrm settings.php examples the DSN is something like

mysql://crm_db_username:crm_db_password@db_server/crm_database?new_link=true

but why the new_link setting? Isn't it much more efficient to re-use an existing mysql connection than to open a new one each time?

1 Answer 1

1

If you only ever connected to one database on the same database server yes. If you run e.g. drupal and civi in different databases on the same server you will have problems. Even if you don't, it's theoretically possible a 3rd party civi extension uses its own separate database (but probably rare).

7
  • I have a wp site with separate databases for wp and civicrm. Acording to php.net/manual/en/function.mysql-connect.php the same connection will be reused if the same parameters are given to the connect. So I don't see why it would cause problems. Could you explain? And if what you say is true, then if I use the same db can I drop that (even if WP is no longer using mysql but mysqli?
    – Franky
    Sep 9, 2016 at 6:34
  • mysql_connect doesn't specify the database. The currently active database for a given connection can get clobbered if re-using connections.
    – Demerit
    Sep 9, 2016 at 16:28
  • I am not sure about how it works when mixing mysqli and mysql, but you might rarely still have a problem with unusual extensions. Are you running into resource problems? It seems unlikely new_link would be the biggest factor.
    – Demerit
    Sep 9, 2016 at 16:32
  • Well, my wp and civicrm are on the same db server (installed by my hosting provider), but while my regular wordpress is snappy, the civicrm pages can be slooow ... even without any contacts in it at all.
    – Franky
    Sep 10, 2016 at 6:50
  • So I'm looking at all possible factors. Is mysqli already stable in civicrm (and is it any faster than mysql)? I'm hoping for php7 in 4.7.12 :-)
    – Franky
    Sep 10, 2016 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.