Database Search and Replace Script in PHP | inter.connect

Before we go any further. We know this page gets a lot of attention from around the world as this is a useful tool for many. We’d like to say that we stand with Ukraine. We have many friends from Russia and from Ukraine. We believe in transparency and freedom. The Russian government has taken a dangerous step too far that is causing tragedy across Ukraine and hardship for ordinary Russians. Please work to bring modern, transparent democracy to Russia and freedom to Ukraine. To help, please consider donating to one of the many honest charities supporting the children and people of Ukraine.

Ukrainian landscape of yellow flowers and blue sky

For how we use your data, please see our privacy policy.

Download and/or Donate to Search Replace DB

We won’t use your data, and the only possible time we’ll contact you, apart from with a download link, is if we’re aware of a serious problem in the tool where all past users need to be informed.

  • Risk check

    *

    • I acknowledge the risks inherent in using developer tools, and accept that this script must not be left on a public facing server.

  • Name

    *

    First

    Last

  • Organisation Name

  • Email

    *

    Enter Email

    Confirm Email

  • Suggested donation

    *

    It’s cost us thousands over the years to keep updating and supporting this script. Your help can make a huge difference and would be massively appreciated. But you can choose $0 and that’s just fine.

  • Set your own donation

  • Total

    $0.00

  • Would you like to receive our rarely published newsletter?
    • Yes! I’d love to receive your newsletter!

    And here’s our promise – no spam, no more than twelve newsletters a year and probably rarely sent at all, and we will never ever pass on your details to a third party.

    Your data is stored only for when you have requested a newsletter and to confirm your acknowledgement of the dangers of the tool. Your acknowledgement cannot be deleted as it forms part of our auditing for your safe use of the tool and also allows us to inform you of any major issue. We will not acknowledge subject deletion requests, but you can always unsubscribe from any newsletter you’ve subscribed to.

  • Thank you – once you click submit the email will be sent to you with a download link. Please check your junk folder! You will also be taken to PayPal to make your donation.

  • Email

    This field is for validation purposes and should be left unchanged.

Δ

Installation

Download the script from the link you received by email, and install it to a secret folder with an obfuscated name if used on a public facing server. Your server should also not be set to provide directory lists if it’s a public server.

Do not install Search Replace DB to the root folder or you risk all sorts of potential problems. Just don’t. It must run in its own folder and ideally one that can’t be easily guessed.

To see how you can use this tool to aid migrations, check out our article on WordPress migrations or visit the WP Tuts+ article that mentions this script.

If you are in any doubt whatsoever about how to use this standalone script, then please consider getting an expert in. It’s a really powerful bit of code that if used badly can damage your database beyond repair. If you want help, get in somebody like us, for example, or any of the other great guys listed over at CodePoet.

License

The code is supplied under the GPL V3 and is fully open source. Do be aware that this means people can change this code and offer it up, and that other versions may be worse… or better. It is code for developers, by developers, and you should only use code from sources you trust.

FAQ

Where do I install the unzipped files?

In a directory on your webserver. It can be an httpauth protected folder if it’s a public facing webserver.

Do I have to pay?

No, this is free open source and you can find it on GitHub. You can also do things like send copies of it to your friends, or use the code in other projects. The full license is included in the software. We make the default path one of letting you make a donation, but if you’re skint and you work in one of those corporates where getting approval for a $5 spend isn’t worth the hassle, you can grab. Just remember us if the script makes you look good and gets you a raise!

I heard this script is insecure. Is it really?

Not as dangerous as it used to be! For convenience, we picked up the WP config variables to prefill the database details. Problem with that is that it turns out people are careless and would leave the script lying around on their production facing server. So that had to go. Convenient for dev installs, nightmare on a production server. It’s still a powerful tool, and it gives access to a hacker to try and brute force your database credentials, so it’s really important that you don’t just leave the script lying around still, but if you are using this on production servers and you are a bit absent minded then you won’t be punished by getting hacked quite so easily.

I get an error 2: Class __PHP_Incomplete_Class has no unserializer

This is a common error and generally comes up with users of Yoast plugins, but also some others. It’s something we’re aware of. In the vast majority of cases everything is fine. You could try running the script from a different PHP install – there is no reason why you can’t have a pipe to a production database and connect to it from your workstation, for example. We’ve done our best to ensure that the script A little more detail is on our github repository.

Changelog:

We no longer publish the changelog on this page – you can view it at Github.

Contributions

We’d love to get contributions, bug reports and more on the Search Replace DB github repository. Please come on over – you’ll be more than welcome but you will need to request access by emailing [email protected]