Warning This documentation is outdated and probably broken – proceed at your own risk
This guide covers how to set up a local apache server for use with php development in eclipse. The server runs on port 8080 on your local machine, and only allows access from your local machine.
Note that you must have eclipse installed and set up along with the phpeclipse plugin.
Install apache and php
Install the apache, php4, php4-mysql, mysql-client, and mysql-server packages (if they aren't already installed).
Set up an apache running directory
Go into your home directory, and create a directory called 'apache'. This will be where the server will contain all the config and log files.
Download the sample
config file for apache into your newly created apache running directory as httpd.conf . There are a few lines you need to change in the config in order to get the server to run correctly.
Find the ServerRoot directive, which should look like this:
Change this to point to your apache running directory, created earlier. For example, mine points to /nfs/guy/u1/selman/apache . Be sure not to put a slash at the end of the directive.
Next, find the DocumentRoot directive, which should look like:
Change this to point to your eclipse directory. All files within the directory will be accessible by the server.
A few lines down, you should see a directive that looks like:
Change this to point to the same directory you specified in the DocumentRoot directive.
Make a custom copy of apachectl
apachectl is a handy script for handling apache processes. Locate this file (which is usually located in /usr/sbin/apachectl) and copy it to your apache directory.
Again, we need to modify the file to make it work with our local apache service. Open it with your favorite editor and look for the line in the configuration section that specifies where the PID file is located. Change it so it points to the apache.pid file (which will be created upon the first server launch) in your new apache directory. For instance, mine looks like:
Now, modify the HTTPD variable so that apache knows to use an alternate config file than the one located at /etc/apache/httpd.conf. Make it point to your (renamed) httpd.conf that you modified earlier. Again, my file looks like:
That is all the configuration required. Test the server by running your apachectl command.
If everything started fine, and you can see your eclipse directory at http://localhost:8080/
then proceed to the next step.
Setting up eclipse to recognize the apache server.
Launch eclipse. Click on Window -> Preferences, then click on PHP in the left box. Here are the values you should change:
- Click on the 'Use External Browser' checkbox, then fill in your favorite browser in the 'External Browser Command' window. Mozilla's profile system can really wreck havoc with you, so if you're like me and you always have a mozilla process running, you can change this to say 'firefox -remote openurl({0}, new-window)' and a new window will be opened in your workspace every time you view a php file with the browser. For more information on the -remote option, visit this page
.
- Fill in the localhost box with http://localhost:8080
. Note there is no / at the end.
- Set the DocumentRoot box to your eclipse directory.
- In the apache box, make sure that all the checkmarks that say 'Run in background mode' are checked. Then fill in the start apache, stop apache, and restart apache boxes with 'start', 'stop', and 'restart' respectively.
- Finally, set the 'Apache' box to the full path of your custom apachectl file. Mine is set to '/nfs/guy/u1/selman/apache/apachectl'.
Conclusion
Test out the configuration to make sure everything works. Click on PHP/Apache -> Start Apache. Then right click on one of your php files and select 'Open PHP browser'. If everything worked correctly, a browser window should launch, showing you the output of your php file.
http://www.locked.de/div/dbg-install.html


http://xdebug.org
http://pecl.php.net/package/apd