为Eclipse配置Apache HTTP Server

hqt*_*hqt 10 eclipse apache

也许这个问题很愚蠢,但我真的不知道如何解决.

首先,作为其他服务器,我想定义新的服务器.所以,在Eclipse中,我转到:Windows> Preference> Server:

1)当我添加新服务器时,在列表中,没有Apache HTTP服务器的类别.只有Apache Tomcat.所以,我点击进入下载附加服务器适配器 - >仍然没有列表.

2)所以,我搜索.我指向我已安装的位置.好的,Eclipse认为这是一个HTTP服务器.Eclipse看到了将项目放入我的文件夹(因为我使用LAMP,因此该文件夹不在Apache文件夹中).

但这是我的问题.当我想运行一个新的PHP项目时.右键单击,在服务器上运行.出现一个新对话框,让我选择要运行的服务器.而且,在服务器列表中,没有HTTP Server,所以,我不知道如何选择Apache HTTP Server!(因为Eclipse没有看到我定义的服务器,eclipse只是先找到适配器)

所以,如果我想运行这个项目,我必须复制所有并粘贴到Apache文件夹.太方便!!!

请帮我.

谢谢 :)

Gil*_*anc 7

Apache的HTTP服务器和Eclipse不会相互通信.Windows - > Preference - > Server下的服务器是Tomcat和Glassfish等Java服务器.

您需要做的是在Eclipse中定义Web项目,然后在httpd.conf文件中将该目录定义到HTTP服务器.或者,因为您已经设置好了,所以在Eclipse中编写Ant脚本以将PHP文件复制到HTTP文件夹.

编辑添加:这是我的Ant脚本,用于保持我的Eclipse目录和我的HTTP目录同步.我在Windows中开发.

<?xml version="1.0" encoding="UTF-8"?>
<project name="build" default="" basedir=".">
    <description>
       Synchronize the Eclipse folders and the web site folders
    </description>    
    <!-- Relative location of eclipse folder -->
    <property name="eclipse" value="." />
    <!-- Absolute location of web site folder -->
    <property name="website" value="C:/Presbury UMC/" />

    <!-- Copy new web site files -->
    <copy todir="${eclipse}">
        <fileset file="${website}/index.php"/>
    </copy>
    <copy todir="${eclipse}/css">
        <fileset dir="${website}/css"/>
    </copy>
    <copy todir="${eclipse}/images">
        <fileset dir="${website}/images"/>
    </copy>
    <copy todir="${eclipse}/protected">
        <fileset dir="${website}/protected/">
            <exclude name="yiic*"/>
            <exclude name=".htaccess"/>
        </fileset>
    </copy>   
    <copy todir="${eclipse}/themes">
        <fileset dir="${website}/themes"/>
    </copy>

    <!-- Copy new Eclipse files -->
    <copy todir="${website}">
        <fileset file="${eclipse}/index.php"/>
    </copy>
    <copy todir="${website}/css">
        <fileset dir="${eclipse}/css"/>
    </copy>
    <copy todir="${website}/images">
        <fileset dir="${eclipse}/images"/>
    </copy>
    <copy todir="${website}/protected">
        <fileset dir="${eclipse}/protected/"/>
    </copy>   
    <copy todir="${website}/themes">
           <fileset dir="${eclipse}/themes/"/>
    </copy>   
</project>
Run Code Online (Sandbox Code Playgroud)