I Uploaded My Database but Sit Is Still Down

Migrating your WordPress site to another location should exist a painless procedure: you just take to export your database, import it to the new host, move your files in that location, configure everything and make the new site live. However, there are some steps that, when not done correct, could provoke several problems that cause problem and lead to unsuccessful site transfers. In this post, I review the required steps in a WordPress migration to prove you the virtually mutual problems I have found afterward 3 years migrating sites for customers of Migrate To WordPress.

Exporting/Importing your WordPress Database

The first stride to kickoff a migration of your WordPress site is to move the contents from your current host to a new server. To do this, you could apply the Import/Export native function that WordPress has. All the same, this may fail or not export/import all of the contents you take defined, but only a subset. To avoid this, I always recommend toget for the database directly, and export a SQL file. But, this may also cause some trouble.

If yous accept admission to your database through phpMyAdmin, just try to export the SQL data following the steps explained in this article almost squeamish phpMyAdmin tutorial to export your data. Depending on the specific configuration of your server and the size of your database, the procedure of exporting your contents to a SQL file may fail considering of retentivity or timeout errors.

Alternatively, if yous do not have access to phpMyAdmin you tin can effort the WordPress plugin Adminer, which provides the same functionality as phpMyAdmin. Notwithstanding, information technology may likewise cause memory and timeout errors when trying to export your data. Just it is e'er worth to try information technology.

Another possibility you have is trying to export the data direct through MySQL commands. If you have SSH access to your servers you tin can use the command mysqldump to do this:

Consign a SQL file from your database

mysqldump -uUSER -pPASSWORD DBNAME > consign.sql

Import a SQL file to your database

mysql –uUSER –pPASSWORD DBNAME < export.sql

Call up to alter USER, Password, and DBNAME to the right values in your installation. If you have forgotten these credentials, open your wp-config.php file (when you have access to it) and you'll detect them in that location.

If that fails to work, producing a timeout error, or mysql and mysqldump are not available, then you need to contact the support squad of your current hosting provider and asking them to create a backup of your database. Afterwards that, you should inquire your new hosting provider to import the previous export file into the new database for you.

Transferring Files, Plugins, and Themes

Once you have your database fix, it is fourth dimension to transfer the files stored in your old WordPress host to the new one. Basically, this means copying all the contents from the following folders:

  • wp-content/themes: hither is where all your WordPress themes are located. Merely copy all of thecontents to this folder, unless you make up one's mind to switch to a new theme. In that case, you tin can ignore these files.
  • wp-content/plugins : here is where all your WordPress plugins are located. Once again, copy all thecontents to new new host. Annotation that the plugin configurations are stored in your WordPress database, and so later importing the SQL file from the previous steps, everything should work perfectly in your new host.
  • wp-content/uploads: here is where all the media files that appear in the Media Library are located. Note that the size of this folder may be huge when using a lot of images in your site.

Speed Upward File Download/Upload

If you have a very big WordPress installation with a lot of media files, file transfers may have ages to download from your host and upload into the new one. If that'southward your case, effort to do the file transfer in a identify where you have a adept internet connexion, because you'll probably demand it. Fortunately, there are some tips that can help you transferring the media files much faster. Let me review them:

  1. Whenever it is possible,make a compressed archive (.zip, .rar, or similar) of your media files before transferring them. It's faster (and simpler) to move one big file rather than thousands of minor ones. However, some hosting providers practice not permit this functionality or do not permit you lot to have SSH admission to your server. If you only have FTP/SFTP admission, become to tip 2.
  2. When transferring multiple files from one host to another, avoid using FTP/SFTP directly. Attempt parallelizing download/upload connections past using LFTP and mirror commands.
  3. If you take SSH admission to both servers (the erstwhile and the new one), transfer your files (or compressed archive file) directly from your old hosting provider to the new server, instead of downloading them locally into your computer and then uploading them from there.

Regarding LFTP, here are the commands that you should utilise to download and upload the previous folders recursively and with parallel connections, reducing the last amount of time required for the transfer:

Download files to your figurer

lftp -c "open up ftp://$username:$countersign@$ftp_hostname;lcd /path/to/local/directory/in/your/computer;cd /path/to/remote/directory/in/ftp/server;mirror --parallel=20 --only-missing;"

Upload files to new host

lftp -c "open ftp://$username:$countersign@$ftp_hostname;lcd /path/to/local/directory/in/your/computer;cd /path/to/remote/directory/in/ftp/server;mirror --reverse --parallel=20 --only-missing;"

Issues with File Permissions

When you transfer files from one host to another, their permissions are moved too. Some hosts allow you to have files with permissions similar 777, which in UNIX means that anybody can have full access to the file (read, write, and execute it). Such file permissions present a huge security risk, and if you are switching to a host that cares about security and forbids this, transferring files may issue in an "Internal Server Error" page.

Having SSH access to your server, y'all can change the permissions of the files through the following control:

chmod -R 644 /path/to/binder/

It is likewise possible that your new hosting provider allows you lot to modify permissions of your files through an option in their Assistants Panel, like WPEngine does:

Fix file permissions in WPEngine
Fix file permissions in WPEngine

Prepare Thumbnail Sizes

The moment doing a WordPress migration is the perfect time to redesign your theme or directly switch to a new one. If that's your example, accept a look at your featured images, because it could happen that all the new images that are uploaded after activating the new theme look good, butthe former thumbnails appear ugly and distorted. And just trying to adapt epitome sizes in Settings -> Media, won't solve the problem.

It is important to note that when you upload an prototype to WordPress, it creates duplicated images of the original ane (called thumbnails) of dissimilar sizes and saves them in the uploads folder. What sizes? WordPress gets the image sizes for thumbnails from your theme. Your theme defines the thumbnail sizes, which are actually useful to load the best epitome size when needed. There is no demand to load huge images when displaying a listing of posts. In these cases, your theme displays smaller thumbnails. Adapting the thumbnail size to each state of affairs improves the concluding loading time of your WordPress.

All the same, as we have already mentioned, the problem is that these new paradigm sizes are only applied to the images that yous upload afterwards activating the new theme. To solve this problem yous need to generate new sizes for all the previously uploaded images. This process is often referred to as regenerating thumbnails and, as e'er, in that location is a plugin to practise that.

In order to practise this, you only have to install the plugin Regenerate Thumbnails in your WordPress installation. Then, activate the plugin and  become to Tools -> Regen. Thumbnails. Press the button Regenerate All Thumbnails to start regenerating the thumbnails for all image uploads. You can also regenerate the thumbnails for private image uploads or specific multiple image uploads in Media -> Library.

Regenerate thumbnails in WordPress
Regenerate thumbnails in WordPress

Note that this plugin does not delete previously created thumbnails by onetime themes. This is something yous should practise manually if you are sure that you haven't used those sizes anywhere on your website. Look for images inside your wp-content/uploads folder in WordPress that have former unused dimensions. Be conscientious when deleting them; information technology will complimentary space in your hosting disk, but it can also take side-effects on your site when deleting wrong images (images that you really use).

Regenerating thumbnails is very handy if y'all've changed whatsoever of your thumbnail dimensions (via Settings -> Media) after previously uploading images, or have switched to a theme with different featured image dimensions.

WordPress Configuration afterward Migration

This part can be tricky besides. Your database has lots of references to your old site. If yous inverse your domain name in a migration, trying to access to your new WordPress site later on importing your database file will upshot in several redirection problems. The reason for this is that your WordPress thinks that it is located in your old server with your old domain. To solve these wrong URL address problems, go on reading.

Telling WordPress that the Site's Location Has Changed

WordPress stores your site location on the wp_options table. You can encounter it when y'all become to to Settings -> General:

"Settings

If the URL you see in that location is not the URL of the new domain,WordPress will ever redirect you to the URL you have there. In order to easily fix this issue, search for the following lines in your wp-config.php file (or add them to the end of that file) and put there your right URL:

define('WP_HOME', 'http://my-domain.com'); define('WP_SITEURL', 'http://my-domain.com');              

These two statements tell WordPress to ignore the values in the database and use the home and site URL values that y'all specify in the wp-config.php file.

Updating URLs in Posts and Custom Fields

When you modify the domain name, you need to update all the posts and custom fields that include the old URL with the URL of the new domain. When you insert a link or an paradigm, WordPress will store it with its full path. All these absolute references have to be replaced when y'all're moving to the new domain. Otherwise, all inline link and images still point to the previous domain, producing 404 errors.

To fix this, we can direct go to phpMyAdmin and access our WordPress database. Earlier doing anything, y'all should backup the database, using the export role nosotros described before. Afterwards, you can apply the following SQL statements:

UPDATE wp_options SET option_value = Replace(option_value, 'http://my-old-domain.com', 'http://new-domain.com') WHERE option_value Not Similar '%{%'; UPDATE wp_postmeta SET meta_value = Replace(meta_value, 'http://my-sometime-domain.com', 'http://new-domain.com') WHERE meta_value Non LIKE '%{%'; UPDATE wp_posts SET guid = REPLACE(guid, 'http://my-one-time-domain.com', 'http://new-domain.com');              

In one case you accept run each of these update statements, phpMyAdmin volition tell you lot how many rows in your database were updated. Check that this number makes sense.

Annotation that I've excluded rows that take the character { in them as they would be office of serialized arrays. To replace URLs (or any other string) inside serialized arrays, get to the side by side section

Fixing Serialized Arrays in PHP

Serialization has go a standard in many programming languages. The trouble with serialization is data portability. Let'due south see an example of serialized data in PHP:

a:2:{i:0;due south:67:"http://my-old-domain.com/wp-content/themes/twentythirteen/mode.css";i:1;southward:0:"";}

Equally you can see, the information is organized in a way that it has data types and number of elements in every data blazon. Concretely, there is a Cord URL that contains 67 characters. And that's the problem.

If y'all modify your domain, replacing it is non enough. If the old and new domain don't accept the same number of characters, and you search and supervene upon the domain URLs in your database, you could get in trouble and decadent your content data.

There's no way to update serialized arrays using simply MySQL queries. You lot need to utilise PHP, load the arrays, find the values, replace them and serialize dorsum. That's very boring and error decumbent, simply there are several tools that help y'all doing the hard job. My recommendation is to apply a plugin that does the consummate migration for you. WP Migrate DB, Duplicator, or All-in-One WP Migration are some examples of expert plugins for this task, and they take care of replacing the serialized arrays.

Alternatively, you lot can use this WordPress search and replace database tool. Information technology carries out database broad search/replace actions that don't harm PHP serialized strings or objects with a user friendly interface.

Change DNS to Signal Target Site

One time you have the new WordPress installation gear up to exist alive, the last step of migrating your website is the DNS change. This is something that merely experienced people should do, because it may cause your site to go down. And you don't want that!

Sometimes, it is better to contact the back up squad of both your old and new hosting providers. They volition aid y'all and provide the correct instructions to follow when performing the DNS change. Notation that domain records changes need a propagation period to take place. This time is required because all of the earth'southward DNS servers need to update their records virtually your domain proper noun.

In add-on to information technology, while waiting for the DNS propagation period to laissez passer, you can disable the comments and login on your one-time hosting. This way, you avoid losing new comments or other user activity during the so-called propagation period. When doing the DNS alter, be careful with your e-mail configurations. Information technology may be the case that when irresolute some records in the DNS configuration, you destroy your mail records. Again, and sorry to echo this, contact a professional to perform this change and ensure that you won't lose anything.

If you liked this article, allow me know by sharing it through your social networks or by writing a comment. And if something is missing, nosotros can work together to include it on the list 😉

Featured image by Benson Kua

williamsanclow.blogspot.com

Source: https://neliosoftware.com/blog/wordpress-migration-problems-and-how-to-fix-them/

0 Response to "I Uploaded My Database but Sit Is Still Down"

إرسال تعليق

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel