6

I was having my site in shared hosting, I took the entire backup, its structure is like

addons          homedir        mysql             resellerpackages  suspendinfo
bandwidth       homedir_paths  mysql.sql         sds               userconfig
counters        httpfiles      mysql-timestamps  sds2              userdata
cp              locale         nobodyfiles       shadow            va
cron            logaholic      pds               shell             vad
digestshadow    logs           proftpdpasswd     ssl               version
dnszones        meta           psql              sslcerts          vf
domainkeys      mm             quota             ssldomain
fp              mma            resellerconfig    sslkeys
has_sslstorage  mms            resellerfeatures  suspended

Now I have subscribed to vps, I have copied the files inside homedir/public_html to var/www/html of my new hosting, but am seeing the following error when I view it browser,

There has been an error processing your request

Exception printing is disabled by default for security reasons.

Error log record number: 259343920016

I have just created database with name magenhto inside mysql. Previously I had cpanel and used one click installer. Hence am not aware of how to use that data inside mysql to this new system and are there any more changes.

3
  • Please add the content auf /var/report/259343920016. Did you change the database-connection (db, username, password, host) in local.xml? Commented Jun 4, 2014 at 6:22
  • I haven't changed any thing. I have the mysql data inside the mysql folder. Do I manually need to create uesr with the old username and db Commented Jun 4, 2014 at 6:30
  • Yes, you need to setup a database with username and passwort on your new server, put this data into app/etc/local.xml and import the database-dump. Import means via web-frontend(phpmyadmin, chive, whatever tool) or via console with mysql. I'm not sure whats in your mysql folder, but i guess you need to create a mysql-dump/export from your old server first. Commented Jun 4, 2014 at 6:33

4 Answers 4

25

The following procedure describes the basic needs for moving your magento-shop to another server. There might be additional things to consider (changing domains, DNS, PHP-Configuration, tools & programms on your server) which need to take care of on your own.

1. Backup files in your Magento directory on your old server:

You might empty your var/cache, var/session, var/report and var/log directory first to save space and speed up the backup

2. Create a database dump on your old server:

Use phpMyAdmin, Chive or via console with mysqldump, n98-magerun

3. Set up directory structure for files and create database + user on your new server

4. Move files and database dump to your new server: via FTP, SSH,...

5. Extract file-backup to your new magento directory

6. Check and set file-permissions

Usually 644 for files and 755 for folders.

See also this question for more information: What permissions should I give /var and /media?

7. Import database-dump on your new server:

Use phpMyAdmin, Chive or via console with mysql, n98-magerun

8. Update new database-settings in app/etc/local.xml

9. Update URLs in core_config_data:

You can edit the base_url via Web-Frontend (phpMyAdmin, Chive,...) or use these SQL-statements. You might need to edit the urls for your stores also.

Look for path ="web/unsecure/base_url" and path="web/secure/base_url" in the core_config_data table.

10. Empty var/cache, var/session, var/report, var/log (if you did not do that before you created the backup on the old server)

11. Reindex your data: catalog url rewrites

12. Enjoy your beer!

10
  • 1
    Why would you delete the entire var folder? Some modules have files in there that should certainly not be removed!
    – SPRBRN
    Commented Jun 4, 2014 at 7:48
  • Right, that could be a problem for someone who is not aware whats kept in their var/ directory. I've edited my post. Commented Jun 4, 2014 at 7:51
  • Var/reports can be emptied as well.
    – SPRBRN
    Commented Jun 4, 2014 at 7:52
  • and var/log also. Commented Jun 4, 2014 at 7:55
  • Thanks , Could you please tell about step 9 and 11. I want to see with ip first I dont want to point any domain as of now, as it is test instance. Also how to do step 11 Commented Jun 4, 2014 at 8:57
6

1) You need to get the sql dump from the old database and import the sql file in the new database. 2) You need to make change in the local.xml. To do so goto app/etc/local.xml Enter the username, password and dbname of the new database you created.

NOTE : Normally host name as localhost works. But for some servers you need to get the host name from the server company and need to change it too..

I have attached a screenshot of local.xml where you need to make a changeenter image description here

3

I won't repeat the other answers. Some advice:

  • Download and zip the entire folder and keep it for a long time as a backup.
  • Backup the database, zip it and keep it as backup.
  • Set rights for all files properly, not only those in the var and media folder.
  • Let the old install run until you know how to move the install in one go.
  • Create a test store on the new test-installation (while the old server still runs) and see if that works with a test subdomain.
3

I want to add one more useful suggestion: In order to simplify the process of migration from one server to another, I would suggest you copying files over ssh instead of downloading and uploading zip files, as It's much faster and efficient way.

Syntax:

scp -r <source> <destination>

To copy a file from B(new server) to A(old server) while logged into B:

scp -r /path/to/magento username@a:/path/to/magento

This is an example of how to copy Magento from B (new server) to A (old server) while logged into A:

scp username@b:/path/to/file /path/to/destination

Your Answer

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

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