开发者

WordPress - Synchronizing local folder and SQL table with server ftp folder / table

I'm about to design / develop a WordPress website for client that wants me to build the site on his server. I prefer to develop locally, and without lag ti开发者_如何转开发me, but I'd like to find a middle ground that works for both of us.

I have transmit for FTP and know there is a way to synchronize a local folder with the server. Although, My concern with this is that while the .php, plugins, images, .css, .js will transfer in this way, the my SQL tables will not.

Is there a way to fully sync up a local WordPress directory with one hosted on an FTP server to keep mySQL tables with posts, plugin settings etc. in tact?

Thanks!


Two ways: periodically export your database at the client's host, import it at local, then change the domain and other URLs in the database locally with an sql query in phpmyadmin, as you won't be able to login to WP locally until you've changes the base site URLs.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

and then update posts:

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

Or: you can call a non-localhost MySQL server in wp-config to you can keep one copy of the database for host and local, as long as the target server is configured to accept outside connections. In wp-config.php:

define('DB_HOST', 'mysql.example.com');  or 
define('DB_HOST', 'mysql.example.com:4454');

You may also need to open ports on your local machine's firewall.


here i've found someone using an SSH script to achieve the synchronization of files and database: http://hecode.com/simple-way-to-backup-clone-sync-online-wordpress-website-to-local-development-website-by-using-ssh/

sincerely i do not understand it (i'm not familiar with ssh) but maybe it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜