Config Apache HTTP Server for Eclipse

Apache's HTTP server and Eclipse don't communicate with each other. The servers under Windows -> Preference -> Server are Java servers like Tomcat and Glassfish.

What you need to do is define your web project in Eclipse, then define that same directory to the HTTP server in the httpd.conf file. Or, since you're already set up, write an Ant script in Eclipse to copy the PHP files to your HTTP folder.

Edited to add: Here's my Ant script to keep my Eclipse directory and my HTTP directory synchronized. I develop in 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>

Go to apache>conf>httpd.conf file and open it.Below "ServerName localhost:80" change your document root and directory to your working directory(in eclipse it is workspace).Now you can run your php file/project by typing its full url in any browser or if you want to run it through eclipse you have to configure that run also by synchronizing both server copy and local copy(in this case both are same)in mapping tab.

Tags:

Apache

Eclipse