12

We have a local environment for development. We need to do a migration from local to a Dev server for integration. Is there any detailed migration guide about how to migrate Magento from one server to another? How to handle the database records and user generated content?

14

There is a quick reference:

Basically, we need to change the connection config in app/etc/env.php, the url config in core_config_data and set the permission your source files.

--After importing the backup database, we need to change web/unsecure/base_url and web/secure/base_url paths in core_config_data table. We can check:

SELECT * FROM core_config_data a WHERE a.`path` LIKE '%web/unsecure/base_url%'
UNION 
SELECT * FROM core_config_data a WHERE a.`path` LIKE '%web/secure/base_url%'

enter image description here

Change theses values to your own url.

--Should change host, dbname, username, pwd app/etc/env.php:

  array (
    'table_prefix' => '',
    'connection' => 
    array (
      'default' => 
      array (
        'host' => 'localhost',
        'dbname' => 'mage21',
        'username' => 'root',
        'password' => '',
        'active' => '1',
      ),
    ),
  ),

--Change the permission and owner of files:

http://devdocs.magento.com/guides/v2.1/install-gde/prereq/file-sys-perms-over.html

http://devdocs.magento.com/guides/v2.1/config-guide/prod/prod_file-sys-perms.html

--May run static content deploy php bin/magento setup:static-content:deploy

--Remember to clear Magento Cache and delete var/generation, var/composer_home, var/view_preprocessed.

There is a good doc here: http://devdocs.magento.com/guides/v2.0/config-guide/prod/prod_deploy.html

[EDIT]

From the Magento 2.2 version, there are many improvements: http://devdocs.magento.com/guides/v2.2/config-guide/deployment/

  • 1
    Accept the answer if it helps you @zzpaul so it help other community members . Just noticed that you didn't accept any answer from your profile – Keyur Shah Jul 28 '16 at 6:28
2

First off all see that the database is exported to the new server.

Then transfer the magento root files to the new server.

In the root folder, change to the new database. You can do this by going to app/etc/env.php and changing the DB array information. change the host, dbname, username and password to the new one.

Then you change you secure and unsecure URLs in the magento DB core_config_data to the new IP, don't forget the "/" after your IP, it's required.

Make the web user owner of the new file ( for apache it's: sudo chown -R www-data /var/www/magentoroot ). Set the correct file and folder permissions.

Finally clear the cache by running bin/magento cache:clean and bin/magento cache:flush.

0

Think, too, of setting up on the target platform any cron jobs that you may have created on the source platform and installing any PHP extensions that you might have had to install, such as for memcached.

If you have set up the testing framework, then you shall need to edit:

dev/tests/functional/etc/config.xml

dev/tests/functional/phpunit.xml

Your sitemap/sitemap.xml will also be incorrect. I am not quite sure when/if a cron job may update it. Otherwise, update manually at Marketing -> SEO & Search -> Site Map

If you have enabled 2FA then you will need to make some changes. I didn't do this the right way, so I ended up disabled the 2FA module and then starting from scratch. But I suppose it might suffice to reset the authenticator:

php bin/magento msp:security:tfa:reset <username> <provider>

See https://docs.magento.com/m2/ee/user_guide/stores/security-two-factor-authentication-manage.html

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.