As explained at Why you should run migrations in Drush rather than the UI, drush is a faster and more robust means of running large migration operations than the web-based UI is. As of Migrate 2.6, it is possible (with some advanced server-side configuration) to start migration operations from the UI that will run in the background via drush on the server.
Configuring background operations
To enable background imports and rollbacks requires some configuration on the server side. The key element is letting the Migrate module know where the drush command resides on the server, so it can be run. This is done by setting the Drupal migrate_drush_path variable to the full path of the drush command on the server, either in settings.php:
$conf['migrate_drush_path'] = '/usr/bin/drush';
or by setting the variable using drush:
$ drush vset migrate_drush_path /usr/bin/drush
On a windows server the path of the drush command has to include '
drush.bat', e.g. like
Another element is to make sure that PHP is on the path for your web server. To verify this, go to http://example.com/admin/reports/status/php and look at the PATH value under Apache Environment. If the PATH does not include the directory containing PHP, you will need to set the PATH appropriately. On some systems, this may mean setting PATH in an envvars file - other system may vary.
On Mac OS X with MAMP, for example, you need to edit the file /Applications/MAMP/Library/bin/envvars and add some additional settings like the following (adjust for the version number of PHP that you're using) to the end of the envvars file and then restart MAMP for it to take effect:
Once you have set the migrate_drush_path variable, visit the Configuration page in the migrate UI. This page will validate that your server is properly configured to run drush (by running a drush status command and verifying its output), and if so it offers further options:
Import method - You can choose for the Import and Rollback operations in the UI to always run migrations through the UI or to always run them through drush. You may also choose to have the option at run time - the operations menu will include the selections Import immediately, Import in background, Rollback immediately, and Rollback in background. Thus, you can choose to use the UI for relatively quick operations, and only use drush for large import jobs.
Send email notification when a background operation completes - If checked, when a background import or rollback completes notification will be sent to the email address of the account running the operation. Whether or not you choose notification, you can always check the progress of an operation by refreshing the dashboard page. When notification is selected, you can enter the subject and body to be used for the email notification.