0

I have set up Craft on my local computer and now wish to move it online. However, I am having some difficulty doing this.

I have tried this method: Migrating a whole website between Craft instances, but with no success. By no success I mean that none of my entries, assets, fields or sections are transferred over.

In terms of transferring the database, I tried downloading it via the Settings page and uploading it via phpmyadmin. Nothing got transferring. I then tried downloading the database from the original site via phpmyadmin and uploading it to my new site (again via phpmyadmin, after having dumped all the tables). Again, nothing was transferred.

I also have tried using various plugins to transfer fields, sections and entries with partial success (but with a lot of manual work left to do).

There must be some way to easily transfer/migrate a site.

Basically, I have my entries, assets, fields and sections which I want to transfer from one site to another without having to manually set everything up again.

How can I do that?

Thanks,

Moshe

ADDITIONAL INFORMATION I wrote that I am ready to move the site online, but what I did was to first set up ANOTHER Craft site on my local server so that I could make sure that I got the process of transfer done properly and then transfer online.

It is to that second install of Craft that I am trying to transfer my site to and which I am having no success.

In other words, on my local (Windows) computer I have localhost/mysite1 and localhost/mysite2. I have the site set up properly on mysite1 and am trying to transfer it to mysite2.

Similarly, on phpmyadmin I have mysitedb1 and mysitedb2. What I have been doing is selecting mysitedb2, clicking on the Import tab and then importing the sql file. phpmyadmin indicates that the import is successful, but nothing changes on the site itself.

FURTHER UPDATE I did a fresh install, made sure that the db.php file is correct and made sure to transfer ALL of the files from the craft folder. I then downloaded a new database backup file from the settings page of my original install and imported that into the new database for the new install.

So far so good.

I received a message which made it seem like everything went smoothly:

Import has been successfully finished, 2080 queries executed

However, when I look at the tables for the database I do not see any of the new data there. I checked the sql file for the names of some of my entry types and they are in the file, but they do not appear in the entrytypes table (other tables also don't have any of the new data).

Any idea what is going wrong?

6
  • 2
    Is the data actually in the database - can you see it in phpMyAdmin on the server? Jun 11, 2015 at 13:09
  • 1
    As an aside from what Phil mentioned, make sure you changed your craft/config/db.php to point to the online server. Make sure there is actually an instance of phpmyadmin on your remote server and you're uploading to it... I've made that mistake before (too many phpmyadmins floating around and you reupload to the test server instead of the new one...) Jun 11, 2015 at 14:18
  • @RitterKnight Solid response! Consider writing that as an official answer.
    – Lindsey D
    Jun 11, 2015 at 15:25
  • TY - will do that. Jun 11, 2015 at 15:43
  • @PhilGyford -- Looks like it. I checked a number of tables relating to assets, fields and entries and they all seem to have the same data.
    – Moshe
    Jun 11, 2015 at 16:00

2 Answers 2

3

It seems that I was doing one of two things wrong.

The most likely problem is that I didn't quite understand how to transfer the database. I was doing a new install of Craft and then uploading the database. The right way to go is NOT to install Craft, but rather to just transfer the files and the database and Craft will then automatically be installed (thanks Lindsey D for teaching me this) .

Another possible factor is that I had changed the Tableprefix, perhaps that was also causing a problem.

Either way, it's works now :). Thanks one and all for your help.

4
  • You're welcome Moshe! Feel free to mark this answer as "accepted", since it describes how you solved the problem.
    – Lindsey D
    Jun 11, 2015 at 22:51
  • Glad to hear you got it working! Jun 12, 2015 at 0:24
  • Thanks to both of you for your help. I'll accept this answer - as soon as the stackexchange system let's me do so :).
    – Moshe
    Jun 12, 2015 at 5:37
  • Well done, glad it works! Jun 12, 2015 at 8:39
2

As an aside from what Phil mentioned, change your craft/config/db.php file to point to the online server.

Also, make sure there is actually an instance of phpmyadmin on your remote server and you're uploading to it. I've made this mistake before... (For example: if there's too many phpmyadmin windows/tabs floating around and you upload the database to the testing server instead of the new one... it'll drive you crazy!)

Basically there's 2 parts to every Craft install: the database and the file system. Craft's db.php lets it know where to find the database information so when you move an install from another server (or 2 another database, in this case), you'll need to let Craft in on the new information.

When you transfer an existing Craft installation to a new server, make sure everything in the craft folder also goes along for the ride (especially the plugins and templates folders).

Once you get the basics down, a multi environment config can save you some hassle later on when it's time to move the site. (Hat tip: Lindsey D.)

10
  • Thanks for the response. What do you mean by an online server? I had to configure db.php correctly to install Craft and I didn't change the file since then. In terms of uploading to phpmyadmin, I'm selecting the proper database, clicking on import and then importing the file. I assume that's what I'm suppose to do.
    – Moshe
    Jun 11, 2015 at 15:48
  • Yes you got that a part down. From your additional information, it looks like your MySQL server credentials are the same but the database is different. In your craft/config/db.php file on the new install, you'll want to change that database to point to mysitedb2 instead of mysitedb. Jun 11, 2015 at 16:20
  • 1
    When @RitterKnight says "change the database" connection info, take a look at multi-environment configs... This allows you to list all of your DB connections at once, so you can keep your db.php file the same across environments.
    – Lindsey D
    Jun 11, 2015 at 17:24
  • @RitterKnight Do I want to transfer everything in the craft folder BEFORE or AFTER I install the new version of Craft? Also, please see my further update in my original question up above. It seems that something is going wrong with the importing of the sql file.
    – Moshe
    Jun 11, 2015 at 17:45
  • @LindseyD: Good point, I'll add it to the answer above. Jun 11, 2015 at 17:48

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.