WordPress - 将本地文件夹和 SQL 表与服务器 ftp 文件夹/表同步
我即将为客户设计/开发一个 WordPress 网站,该客户希望我在他的服务器上构建该网站。我更喜欢在本地开发,并且没有滞后时间,但我想找到一个对我们双方都有效的中间立场。
我已经进行了 FTP 传输,并且知道有一种方法可以将本地文件夹与服务器同步。虽然,我对此的担忧是,虽然 .php、插件、图像、.css、.js 将以这种方式传输,但我的 SQL 表不会。
有没有一种方法可以完全同步本地 WordPress 目录与 FTP 服务器上托管的目录,以保持包含帖子、插件设置等的 mySQL 表完好无损?
谢谢!
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 time, 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有两种方法:定期在客户端主机导出数据库,在本地导入,然后使用 phpmyadmin 中的 sql 查询在本地更改数据库中的域和其他 URL,因为除非您在本地登录 WP,否则您将无法登录 WP我们更改了基本站点 URL。
UPDATE wp_options SET option_value = 替换(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = ' siteurl';
然后更新帖子:
或者:您可以在 wp-config 中调用非本地主机 MySQL 服务器,以便您可以为主机和本地保留一份数据库副本,只要目标服务器配置为接受外部连接。在 wp-config.php 中:
您可能还需要在本地计算机的防火墙上打开端口。
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:
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:
You may also need to open ports on your local machine's firewall.
这里我发现有人使用SSH脚本来实现文件和数据库的同步: http://hecode.com/simple-way-to-backup-clone-sync-online-wordpress-website-to-local -development-website-by-using-ssh/
真诚地,我不明白它(我不熟悉 ssh),但也许它有帮助。
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.