Skip to content

A PHP search replace tool for quickly modifying a string throughout a database. Useful for changing the base URL when migrating a WordPress site from development to production.

Notifications You must be signed in to change notification settings

bananastalktome/Search-Replace-DB

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

Search Replace DB

This script was made to aid the process of migrating PHP and MySQL based websites. It has additional features for WordPress but works for most other similar CMSes.

If you find a problem let us know in the issues area and if you can improve the code then please fork the repository and send us a pull request :)

Usage

  1. Migrate all your website files
  2. Upload the script to your web root (or the same folder as wp-config.php)
  3. Browse to the script's URL in your web browser
  4. Follow the on-screen instructions
  5. Select the Dry-run checkbox to do a dry run without searching/replacing

CLI script

  1. Run the CLI script from the command line like so:
    ./searchreplacedb2cli.php --host localhost --user root --database test --pass "pass" 
       --charset utf8 --search "findMe" --replace "replaceMe"
    
  2. use the --dry-run flag to do a dry run without searching/replacing

You can use short form arguments too so --host becomes -h and so on.

Note

If you use some dynamic processing to setup the database definitions in WordPress try using the 'filestream' branch. Let us know if you find any bugs or have any suggestions to improve it.

About

A PHP search replace tool for quickly modifying a string throughout a database. Useful for changing the base URL when migrating a WordPress site from development to production.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%