I am trying to migrate from my old server (Server 1) from provider 1 to a new server (Server B) at provider 2, keeping the process as seamless as possible.

One of the first things I noticed in the test folder I migrated is that several PHP functions are not supported with Server 2 -- apache_request_headers(), for example. This is supposedly because PHP was not compiled as an Apache module on Server 2. There might be other differences that may cause fatal script errors, that I haven't yet found. Both servers run CentOS with WHM. Is there a way to configure the new server to be exactly the same as the old, without this ad hoc checking?


If you're talking about Apache and PHP only, then just make sure the versions are the same and copy the config files over. If any Apache or PHP modules/extensions are missing, then install them beforehand.

You can use phpinfo() to show the current PHP configurations and active extensions.

Likewise, if you're running PHP as a module, you can use apache_get_modules() to list the active Apache modules. Otherwise, try:

apache2 -t -D DUMP_MODULES


httpd -M

The above commands list every module that is active. To check which static modules are enabled, use:

httpd -l
  • 1
    Ah, so there is no magic way to clone all data, including php setup? – inac Jun 21 '10 at 10:54
  • 1
    Short of virtualization? No. But if you have the same versions of PHP/Apache installed, then copying the config files and mods-enabled, sites-enabled, and PHP extensions directories will get you pretty close. But you still have to check to see if the static modules for Apache are the same. – Lèse majesté Jun 21 '10 at 17:43

Tools such as Puppet, Cfengine or Bcfg2 would help you do this if you're planning on doing this often. But they're more effort than it's worth for one single migration and you should really be able to do this from just the backups you are keeping. And you should have already practised restoring from those backups, so you shouldn't need to be asking this question now.

We migrated an Ubuntu 9.04 web server to Ubuntu 10.04 when the hardware failed a couple of weeks ago. It was a great test of our backup strategy, and we learnt that there are a couple of extra things we should probably be backing up (eg. the scripts which run the backups so we've a documented way of restoring).

But essentially, you need a list of all software installed on your current machine, a dump of databases (with the create-databases option enabled!) and a backup of /etc, /var/www, /home and anything else you currently need.

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.