将 PHP 站点从一台服务器移动到另一台服务器
我对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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
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.
过程是这样的:
the process is this:
你不需要编译任何东西。将项目目录从一台服务器复制到另一台服务器就足够了。如果没有安装您的项目所需的一些 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
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.
无需编译,但是您必须确保新服务器满足应用程序的所有要求(例如服务器模块)并且路径配置正确。另外,在某些情况下,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!