Eclipse output to WAMP webserver www folder

13,693

Solution 1

You can keep the php code in your current eclipse workspace and then create virtual host in the httpd.conf file of apache server with document root pointing to this directory.

Solution 2

You don't need to edit any php.ini files or anything crazy like that; you just need to change a couple of things in Eclipse.

Step #1: Go into Eclipse and click on Window --> Preferences --> PHP --> PHP Servers

There should be a default server listed; you can edit it or just create a new one(this is what I did) and just set it as default later.

Click add or new or whatever it will come up with 2 boxes. The first is just what you want to call the server; call it whatever you like. The second is IMPORTANT -- this is where the www folder for your WAMP server is located. I have a shortcut to it on my desktop with a folder with all my php files in it. I just typed localhost/name of my folder <--- your folder goes here.

It should be localhost/wamp/www if you don't have a shortcut. Don't hold me to that, though.

Step #2 : Running the program

When you have your php file you want to run, right click it and select Run as --> Run Configurations --> PHP webpage(double click). In the "File" area click Browse. Your project folder with your .php file you want to run should pop right up. If not, you'll have to look for it. Select it, then click "Run". Eclipse will open its default browser, and if all went well, you should be able to see your output.

It probably makes it easier if you just use a separate workspace for your PHP projects and store all the files in the www folder(Eclipse should make sub folders for new projects).

Hope this helps

Share:
13,693
Aishwar
Author by

Aishwar

Formerly known as "aip.cd.aish"

Updated on June 05, 2022

Comments

  • Aishwar
    Aishwar almost 2 years

    I have an eclipse workspace folder. I want to store all the different projects I am working on over here. Now I am working on a PHP project and have WAMP installed. Is there some way to configure eclipse such that it outputs my project files to the server's www folder.

    I don't want to create my workspace in the server's www folder, for the following reasons: - I will work on multiple projects over time and I want all of them to reside in the same workspace - I don't want to pollute the web server's www folder (though this is a development machine). I feel that if I have the code in a separate workspace, there is a low chance of me deleting it by mistake. I don't want to end up deciding to clean the www folder and deleting my only copy of the code!

    Any alternative solutions to my concern are also welcome :)