将 PHP (PDT) Eclipse 项目部署到 Apache 的最佳方法是什么?(在 Ubuntu 上)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4097946/
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
Whats the best way to deploy a PHP (PDT) Eclipse Project to Apache? (on Ubuntu)
提问by pedrosanta
What's the best way to deploy a PHP PDT Eclipse Project on Apache 2.2 on Ubuntu?
在 Ubuntu 上的 Apache 2.2 上部署 PHP PDT Eclipse 项目的最佳方法是什么?
I already tried to find an Apache Eclipse server adapter but got no luck. Do you know any?
我已经尝试找到一个 Apache Eclipse 服务器适配器,但没有成功。你知道任何?
If not, what's the best way to deploy a PHP Project to Apache? Shell script? Ant script? Other solution?
如果没有,将 PHP 项目部署到 Apache 的最佳方法是什么?外壳脚本?蚂蚁脚本?其他解决方案?
I could put the project folder inside the Apache's www folder but I would prefer to have the project files on a cloned git repository outside of Apache.
我可以将项目文件夹放在 Apache 的 www 文件夹中,但我更愿意将项目文件放在 Apache 之外的克隆 git 存储库中。
I'm using Eclipse Helios SR1, PDT 2.2.1 and Apache 2.2.16.
我正在使用 Eclipse Helios SR1、PDT 2.2.1 和 Apache 2.2.16。
Thanks in advance.
提前致谢。
回答by Rim
I came across this page looking for a Windows solution and found this little workaround in the meantime that might prove useful to someone:
我在寻找 Windows 解决方案的页面上遇到了这个页面,同时发现了这个可能对某人有用的小解决方法:
- Select Run > External tools > External tools configuration
- Add a new configuration, name it Deploy or something
- Set the location field to C:\Windows\System32\xcopy.exe
- Set the argument field to ${workspace_loc}${project_path}\*.php c:\inetpub\wwwroot\${project_name} /s /y
- Create the directory c:\inetpub\wwwroot\${project_name} manually so xcopy doesn't get confused
- 选择运行 > 外部工具 > 外部工具配置
- 添加一个新配置,将其命名为 Deploy 之类的
- 将位置字段设置为 C:\Windows\System32\xcopy.exe
- 将参数字段设置为 ${workspace_loc}${project_path}\*.php c:\inetpub\wwwroot\${project_name} /s /y
- 手动创建目录 c:\inetpub\wwwroot\${project_name} 以免 xcopy 混淆
This will copy all your PHP files over to your webserver content directory in a subfolder with the same name as your project. The nice part is that you can run this deployment shortcut from the Run Tool button, right next to your Debug and Run buttons.
这会将您的所有 PHP 文件复制到与您的项目同名的子文件夹中的 Web 服务器内容目录中。好的部分是您可以从“调试”和“运行”按钮旁边的“运行工具”按钮运行此部署快捷方式。
回答by Harmon Wood
symbolic links!
符号链接!
ln -s /home/pedrosanta/Workspace/myapplication /var/www/myapplication/htdocs
ln -s /home/pedrosanta/Workspace/myapplication /var/www/myapplication/htdocs
setup your apache virtual hosts accordingly.
相应地设置您的 apache 虚拟主机。
Or you could just set your virtual host's document root to your remote location.
或者您可以将虚拟主机的文档根目录设置为远程位置。
DocumentRoot /home/pedrosanta/Workspace/myapplication
DocumentRoot /home/pedrosanta/Workspace/myapplication
回答by Emil Vikstr?m
I found this question here on SO with a lot of useful answers: Does anybody have a development/staging/deploying workflow with php/mysql?
我在 SO 上发现了这个问题,并提供了很多有用的答案: 是否有人有使用 php/mysql 的开发/登台/部署工作流程?
I hope it helps!
我希望它有帮助!
回答by bpeterson76
Save to local, SVN (or other version control via Eclipse) to branch, branch to trunk, trunk to test, test to live. I can't say enough about how important version control and testing is in any sized environment.....even if it IS a colossal pain.
保存到本地,SVN(或通过 Eclipse 的其他版本控制)到分支,分支到主干,主干进行测试,测试上线。关于版本控制和测试在任何规模的环境中的重要性,我都说得不够……即使这是一个巨大的痛苦。
回答by aredridel
回答by Supun Sameera
I use Apache with eclipe by configuring Apache path to the workspace folder,
我通过配置工作区文件夹的 Apache 路径将 Apache 与 eclipe 结合使用,
in httpd.conf (d:/workspace/php/ is my project location)
在 httpd.conf (d:/workspace/php/ 是我的项目位置)
Alias /php/ d:/workspace/php/
别名 /php/ d:/workspace/php/
Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all
选项索引 FollowSymLinks AllowOverride All Order allow,deny Allow from all
restart Apache and
重新启动Apache和
http://localhost/php/somefolder/somefile.php
Cheers
干杯