将 PHP 站点从一台服务器移动到另一台服务器

发布于 2024-11-06 23:12:45 字数 173 浏览 1 评论 0原文

我对PHP一无所知。

我在服务器 A 上托管了 PHP 网站。现在我想将托管转移到另一家在服务器 B 上拥有 Windows 托管的公司。

我可以将服务器 A 的 WWWROOT 文件夹中的所有内容转移到服务器 B 吗?该网站会这样运作吗?或者我必须获取源代码、编译并发布它?

谢谢!

I have no idea about PHP.

I have PHP site hosted on Server A. Now I want to transfer the hosting to another company having Windows hosting on Server B.

Can I just transfer all the contents of WWWROOT folder of Server A to Server B? Will the site work that way? Or I do have to get the source, compile and publish it?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

情归归情 2024-11-13 23:12:45

PHP(通常)不会被编译,您应该能够简单地复制文件和目录,并且它们至少应该运行。您可能必须设置数据库并与其连接,更改脚本中的某些配置,并且您可能会或可能不会遇到不同 PHP 版本之间的不兼容性和/或 UNIX/Windows 问题,具体取决于编写脚本的可移植性。

PHP is not (usually) compiled, you should be able to simply copy the files and directories over and they should at least run. You may have to set up a database and connections to it, change some configuration in the scripts and you may or may not run into incompatibilities between different PHP versions and/or UNIX/Windows problems though, depending on how portable the scripts were written.

偏闹i 2024-11-13 23:12:45

过程是这样的:

  1. 将内容从服务器 A 复制到 B(也是数据库转储)
  2. 确保您的站点在服务器 B 上正常工作
  3. 在服务器 A 上设置重定向到服务器 B(通常在 .htaccess 文件中)
  4. 编辑 DNS 条目以指向服务器 B
  5. 等待 DNS 更改被获取(注意:根据 Emil 的建议,您可以通过降低 DNS 条目上的 TTL 设置来缩短此时间)
  6. 从服务器 A 中删除内容(最终托管)

the process is this:

  1. copy the content from server A to B (also db dump)
  2. make sure your site is working on server B correct
  3. set a redirect on server A to server B (usually in .htaccess file)
  4. edit DNS entries to point to server B
  5. wait that DNS changes have been picked up (note: as suggested by Emil you can reduce this time by lowering TTL setting on the DNS entries)
  6. remove content from server A (end hosting)
放低过去 2024-11-13 23:12:45

你不需要编译任何东西。将项目目录从一台服务器复制到另一台服务器就足够了。如果没有安装您的项目所需的一些 php 扩展,一件事可能会导致您的项目无法在其他托管上运行。
当然,如果您的项目使用某些数据库,则必须在新服务器上创建它们

you don't need to compile anything. it's enough to copy project directory from one server to another. one thing can cause your project not working on ohter hosting, if there will not be installed some php-extensions that are required for you project.
and of course, if your project uses some databases, they must be created on new server

青春如此纠结 2024-11-13 23:12:45

PHP 脚本是源代码,需要时进行编译。只需移动文件就足够了。如果它是已安装在该服务器上的包,并且在各个文件中可能具有有关其他文件的绝对路径的某些属性,则可能会出现问题。

此外,如果文件与本地 SQL 服务器等通信,也会出现问题。

许多托管公司提供免费(或有时付费)服务来复制您的网站,包括任何数据库。向您的托管公司寻求帮助。

PHP scripts are source code and are compiled when needed. Simply moving the files is enough. Problems may occur if it is a package that has been isntalled on that server and may have some properties in various files about absolute paths to other files.

Also, issues will occur if the files are talking to a local SQL server or the such.

Many hosting companies offer a free (or sometimes payed) service to copy your website accross including any databases. Ask your hosting company for help.

探春 2024-11-13 23:12:45

无需编译,但是您必须确保新服务器满足应用程序的所有要求(例如服务器模块)并且路径配置正确。另外,在某些情况下,PHP 版本也很重要。只有一种方法可以找出答案!

No need to compile, however you have to make sure that the new server meets all the requirements of your application (e.g. server modules) and that paths are correctly configured. Also under some circumstances the PHP version can matter as well. Only one way to find out!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文