We've recently got a few Drupal 8 sites, and needed to move them away from a plesk server. The plesk server is now shutdown for good, and we need to restore the sites on our cpanel server. The sites are using composer, which we don't have any experience with. On top of that, we are not very familier with the drupal structure or system.

We've tried to restore the sites by copying the files relatively with the composer "vendor" folder and replacing strings in the entire project, but it didn't seem to work, or maybe we missed something..

We've also tried to create a new composer project and copied the drupal project into the newly created composer project, but that gave an infinite loop that used up all the ressources and gave an 503 error in the end.

Does anyone know how to move/migrate a Drupal 8 site with composer, from one server to another?

  • The purpose of Composer is not moving/migrating Drupal from a server to another one. Its purpose is installing the dependencies code has, which is different from moving files and database a Drupal site is using.
    – espero
    Commented Mar 12, 2018 at 14:30
  • Composer is just the blueprint that makes up the site. You can take that file and run composer install anywhere, and it should build exactly what you have. It does not assist in migrations.
    – Kevin
    Commented Mar 12, 2018 at 16:29

1 Answer 1


As already said in the comments composer does not have a way to help with transfering a site.

With a site build with composer I usually zip the composer directory (which includes the drupal directory) and get a database dump. On the receiving server just copy the files on a similar directory structure and import the database.

For going from plesk to cpanel you probably have to set the document root correctly. In plesk its usually httpdocs/docroot but in cpanel it should probably be set to public_html/docroot

Also I don't suppose you will need but it does not hurt to run composer update

NOTE: this is a quick and dirty way of transferring from on host to the other assuming that php version and other parameters stay the same, this is by no means a best practice in transferring a site to a new host.

For best practice you should follow the advice in the comments and see the guide on Use Composer to manage drupal site dependencies and the section for Managing existing sites using Composer might come in handy.

  • 3
    This assumes that both servers run on the same PHP version. Otherwise I would recommend not transferring vendor directory but run composer install on a new server instead.
    – ya.teck
    Commented Mar 13, 2018 at 12:40
  • 1
    ^ This is what you should do. With composer.json and composer.lock committed, there is no need to worry about the vendor directory.
    – Kevin
    Commented Mar 13, 2018 at 14:25

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.