如何在 Dreamweaver 中设置 PHP 测试服务器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18919845/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Set up PHP Test Server in Dreamweaver?
提问by Jay
I am trying to setup a PHP server so that I could use the "Live" feature in Dreamweaver, in addition to being able to preview in my browser without having to upload the .php file via an FTP application every time, which is not efficient when I want to do quick small previews.
我正在尝试设置一个 PHP 服务器,以便我可以使用 Dreamweaver 中的“实时”功能,此外还可以在浏览器中进行预览,而不必每次都通过 FTP 应用程序上传 .php 文件,这并不高效当我想做快速的小预览时。
I have setup a new website and selected a folder for the site on my local drive.
我已经设置了一个新网站,并在我的本地驱动器上为该网站选择了一个文件夹。
For the server, I have the following information (I don't know how much of it is relevant):
对于服务器,我有以下信息(我不知道有多少相关):
- Remote: Yes
- Test: Yes
- Server Name: Server
- Connect using: FTP
- FTP Address: my domain name
- Username: my username
- Password: my password
- Port: 21
- Root directory: blank
- Use passive FTP: Yes
- Use IPV6 Transfer Mode: No
- Use proxy: No
- Use FTP performance optimization: Yes
- Maintain Synchronization Information: Yes
- Automatically upload files to server on save: Yes
- Enable file checkout: No
- Server model: PHP MySQL
- 远程:是
- 测试:是
- 服务器名称:服务器
- 连接方式:FTP
- FTP地址:我的域名
- 用户名:我的用户名
- 密码:我的密码
- 端口:21
- 根目录:空白
- 使用被动 FTP:是
- 使用 IPV6 传输模式:否
- 使用代理:否
- 使用 FTP 性能优化:是
- 维护同步信息:是
- 保存时自动上传文件到服务器:是
- 启用文件签出:否
- 服务器型号:PHP MySQL
When I test the server, it is successful and I am able to get the site/server to show up in "Manage Sites". However, when I want to test my .php file on the "Live" preview panel or as a preview in Chrome, I get the error message: "Dynamically-related files could not be resolved because the site definition is not correct for this server." When I upload the .php file to my FTP manually, the page displays properly but when I try doing this it either does not work or the Chrome preview mode just spits out the entire raw code.
当我测试服务器时,它成功了,我能够让站点/服务器显示在“管理站点”中。但是,当我想在“实时”预览面板上测试我的 .php 文件或作为 Chrome 中的预览时,我收到错误消息:“无法解析动态相关文件,因为此服务器的站点定义不正确.” 当我手动将 .php 文件上传到我的 FTP 时,页面显示正确,但是当我尝试这样做时,它要么不起作用,要么 Chrome 预览模式只是吐出整个原始代码。
I tried and Googled, but I could not find a solution to this problem. Any help would be greatly appreciated.
我试过并用谷歌搜索,但我找不到解决这个问题的方法。任何帮助将不胜感激。
Side note:I have my hosting from GoDaddy and the server from there is based on MySQL.
旁注:我的主机来自 GoDaddy,那里的服务器基于 MySQL。
Thank you.
谢谢你。
回答by usrNotFound
To set up PHP server with dreamweaver follow the following steps
要使用 Dreamweaver 设置 PHP 服务器,请按照以下步骤操作
Step 1.
第1步。
Make Sure you have MAMA(For MAC OX) or WAMP (Window OS) install. If you dont know where to get then click this link http://www.mamp.info/en/downloads/and install in you system. (make sure if you are using skype close it because skype and mamp use same port. Later you can chage the port for Skype)
确保您安装了 MAMA(适用于 MAC OX)或 WAMP(Windows 操作系统)。如果您不知道从哪里获得,请单击此链接 http://www.mamp.info/en/downloads/并安装到您的系统中。(确保如果您使用的是Skype,请关闭它,因为Skype和mamp使用相同的端口。稍后您可以更改Skype的端口)
Step 2:
第2步:
Open Dreamweaver and choose
打开 Dreamweaver 并选择
Site > New Site
Step 3:
第 3 步:
Type your site name and click on browse button to locate you htdocs folder (which is normally inside you mamp/wamp folder on you root directory).
输入您的站点名称并单击浏览按钮以找到您的 htdocs 文件夹(通常位于根目录下的 mamp/wamp 文件夹内)。
Step 4:
第四步:
Select Server from left hand side and click on add (+) sign.
从左侧选择服务器,然后单击添加 (+) 符号。
Follow the following:
请遵循以下步骤:
Server Name: localhost
Connect Using: Local/Network
Server Folder: (this is wehre your site located (i.e. inside htdocs folder)
Web URL: http://localhost/yourSiteName (yourSiteName is name of your folder)
Click Save.
Step 5:
第 5 步:
Check Testingand click SAVE
勾选测试并点击保存
Step 6:
第 6 步:
Last but not least Open File Panel
最后但并非最不重要的打开文件面板
Window > Files
Now create a new file and Save it inside you folder.
现在创建一个新文件并将其保存在您的文件夹中。
Thats it you are set mate.
就是这样,你被设置为伙伴。
hope thats helps Cheers!
希望这有助于干杯!
回答by JRizz
The problem is when you try and run your PHP file from your local machine, there's no web server running - nothing on your machine knows what to do with that file.
问题是当您尝试从本地机器运行 PHP 文件时,没有运行 Web 服务器 - 您的机器上没有任何东西知道如何处理该文件。
The solution is to run a local version of Apache, PHP, MySQL on your local machine - the easiest way to do is to download xaamp - http://www.apachefriends.org/en/xampp.html. Put your website files in the htdocs directory once it's installed, and you can view them by going to http://localhost/websitefoldername
解决方案是在本地机器上运行本地版本的 Apache、PHP、MySQL - 最简单的方法是下载 xaamp - http://www.apachefriends.org/en/xampp.html。安装完成后,将您的网站文件放在 htdocs 目录中,您可以通过以下方式查看它们http://localhost/websitefoldername