5

I am using CiviCRM on WordPress and I am moving my hosting to WP Engine - where I have all of my other sites hosted. Unfortunately, I set this instance of CiviCRM to use a separate database, however, WP Engine only supports one database per install. I am trying to convert my existing CiviCRM install to use the default WordPress database before I migrate the site to WP Engine. Is this possible?

If I can't convert the install, can I create a new install (using the WordPress database) and IMPORT the data from the old site?

3

It's actually quite simple to combine your databases.

  1. Do a database export of your WP database:

    mysqldump -u [username] -p [wp database name] > wp-original.sql
    

    It'll ask for your password and then output your WordPress database to the wp-original.sql file.

  2. Do a database export of your CiviCRM database:

    mysqldump -u [username] -p [civi database name] > civi-original.sql
    

    It'll ask for your password and then output your CiviCRM database to the civi-original.sql file.

  3. Create a new database that'll be your combined database. This way, you will still have your two original ones in case of emergency. Grant permissions on the new database to the user that has permissions for your WordPress database.

  4. Load the two exports into the new database:

    mysql -u [username] -p [new database name] < wp-original.sql
    mysql -u [username] -p [new database name] < civi-original.sql
    
  5. Edit your wp-config.php to have the new database name:

    define('DB_NAME', '[new database name]');
    
  6. Edit your civicrm.settings.php to have the new database name (and appropriate username/password, if you had different ones for CiviCRM). This will need to be done in both places--once for the CMS database and once for the CiviCRM database.

    define( 'CIVICRM_UF_DSN', 'mysql://[username]:[password]@[hostname (probably just "localhost")]/[new database name]?new_link=true' );
    
    define( 'CIVICRM_DSN', 'mysql://[username]:[password]@[hostname (probably just "localhost")]/[new database name]?new_link=true' );
    

    You can probably just copy the CIVICRM_UF_DSN value once you've fixed the database name and paste it in place of the CIVICRM_DSN value.

  7. Log in and make sure everything works on your existing server.

For Drupal and Joomla users, the principle is the same, just with settings.php and configuration.php, respectively, instead of wp-config.php. The only difference is that on Joomla, you need to fix both civicrm.settings.php files (in administrator/components/com_civicrm and components/com_civicrm).

Now, I used to say that you should never put your site on WPEngine because they used to only run a version of PHP that was too old for CiviCRM. That's been fixed. However, they still run very aggressive caching, and you may find it to be a problem with CiviCRM.

You should definitely do your first run over there as an experiment and test it heavily, logging in as various users and trying out a variety of CiviCRM features. There's a good possibility that it will either be unusable or take more of your time than you'd save by having things in the same place. If you think of it, please comment with your experience--whether it works or doesn't.

  • Andrew, I had thought WP Engine was either 5.3.3 or HHVM only, do you know what they updated to? – Kevin Cristiano Oct 16 '15 at 15:59
  • 1
    I had simply seen this blog post: wpengine.com/blog/php-5-5-upgrade-available-wp-engine-customers Reading the link shows that it's HHVM with failover to PHP 5.5. Who knows how that performs. More fundamentally, WPEngine does things so heavy-handedly that I would never consider putting a CiviCRM site on there in the first place. – Andrew Hunt Oct 16 '15 at 16:23
  • HI Andrew, thanks for the great response - I never thought of combining the databases into a third database. I am currently working with a test site anyway, so I will try this tip this afternoon and let you know how it works. The real site is running on Hostgator currently, so I really need to move it. It's my only CiviCRM install, so if it doesn't work on WP Engine, I will move it to a recently vacated SiteGround account. – DanM Oct 18 '15 at 20:46
  • Just been talking with WPEngine tech support.Apparently they only run HHVM on "selected servers" so I wouldn't need to worry about that. I was also told that they do have customers running CiviCRM, and that if I had any issues relating to caching to let them know. I'm about to begin testing it out for real... – Graham Nov 11 '15 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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