•  » Engine
  •  » PHP Eclipse developpment environment

#1 2010-02-17 20:53:57


PHP Eclipse developpment environment

I put this little guide together for everybody interested in doing some development in eclipse.
It shows how to get a basic eclipse PHP environment but not yet the piwigo part. This will come later in an
separate posting once i have set this up.

Have fun

Interested in Piwigo but missing some stuff ( well not really ) I wanted to see if I could do some development and was looking for a decent development environment including a decent debugging tool. Coming more from the Java side looking to Eclipse was more or less a nobrainer.
Here is with what i came up with. The following is for Windows but i will ev update it for Linux as well.

What you need :

Eclipse PDT get it from here :

Xampp : This contains all the rest of the env in one convenient package ( Apache, php, debugger and mysql lots of other goodies ) Get it from here ( for this tutorial get the Windows Version in zip format ) :

Xampp contains : Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System pour Win32 et NetWare Systems v3.32, Ming, JpGraph, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, et WEB-DAV + mod_auth_mysql. But also  XDebug for debugging PHP.  Plenty enough for having some fun. ( For more info on XDebug see here : ; No need to download it though! )
That's it nothing more :  Eclipse PDT + Xampp

Now for installation:

What i like here with both tools is that i don't have to do a great deal of installation into obscure places or even configuration . Installation comes as easy as unzipping what you downloaded !
Now off we go:


First install xampp ( i used the zip downlaod ) i.e. unzip it into some convenient  location e.g. I put it into :
Done. Nothing more required. Let's test if it works as expected:
1) Run xampp_control which allows you to start Apache and mysql by the press of a button from here: C:\software\xampp\ xampp-control and start at least Apache. ( Press the start button ).
2) Test the installation by going to http://localost  in any browser and you should have a nice xampp welcome page. Check out your php install by clicking on phpinfo() on the lefthand side.


Now install eclipse i.e. unzip into some convenient location. I did this as for xampp on
Finished; Installation has been done!! Run eclipse at C:\software\eclipse\eclipse and it should fire up.
That was too easy yes you are right we still have some configuration in both tools to do before our setup is complete  in order to work properly in particular with the Debugger! And yes we have to install piwigo too :-)

Configuration :

Xampp :

In order to get the debugger going we have to edit the php.ini file located at:
uncomment the following line :
# zend_extension = "C:\Software\xampp\php\ext\php_xdebug.dll"
This enables XDebug for your php environment. You can check this by going to http://localhost and check phpinfo(). (Make sure that Apache is running in the xampp control panel).  Just before the PHP Credits section on the lefthand side of the Zend logo it should say now "with Xdebug ...."

Eclipse :

Now we have to configure eclipse a little bit :
So start eclipse and go to "Window" -> "Preferences" and select the little triangle on the left of  "PHP" on the left side of the window. This will give you a set of options for the PHP environment.

1) click on the little triangle on the left of "Debug"  and select "Installed Debuggers" This should give you two items "Zend Debugger" and "XDebug". This is just to verify that XDebug is properly recognized. Nothing to do here.

2)  click on "PHP Executables" and select "Add". In the popup provide a name a e.g. "PHP 5.3.1" and set the paths for the executable and the ini file. In my case :
"Executable path" : C:\Software\xampp\php\php.exe
"PHP ini file:" C:\Software\xampp\php\php.ini
as a last step set the PHP debugger to "XDebug" and click "OK"

3)  go back to the "Debug"  option BUT this time click on "Debug" and not on the triangle as in step 1)
This will give you some fields to fill under "Default Settings":
PHP Debugger : select "XDebug"
Server : "Default PHP Web Server"
PHP executable : In the drop down list select the entry with the name you gave your executable in step 2)

Thats it now we are ready to do some testing and make a first small script for verification before we look into installing piwigo into this environment:
You guessed it this needs some more configuration in this case on Apache as the webserver will have to find the files which are in the workspace of your eclipse project but first lets set up a small PHP project in Eclipse.  Remember eclipse asks for the workspace to start in when launching?

For the purpose of illustration I assume the workspace being C:/workspace but this can be anywhere you like it but remember Apache will have to find that path. We come back to this later when configuring Apache.

So you launched eclipse with C:/workspace as your workspace for this session. Next we create a new project : "File" -> "New" -> "New PHP project". In the new project window give it a name e.g. "debugTest" and click "Finish". The project will show up on the left hand side in the PHP Explorer. Do a right click on the project name and select "New" -> "PHP file". Give it a name "hellopiwigo.php"  and click "Finish". This adds the file to the project and put you in the middle plane in edit mode on that file. Add the following
$name = "piwigo";
for ($i = 0; $i <= 100 ; $i++) {
    print("Hello, $name ($i)! \n");
Save the file (Ctrl-S) will do the job. Nothing fancy here but it will do the job for you playing around with the debugger afterwards.
Now we have our PHP project. Can we just run it ? Of course you can ! Right click on the "hellopiwigo.php" and select either :
"Run as" -> "PHP script"  : This will display the results in the "console" view (one of the tabs on the middle bottom pane)
"Run as" -> "PHP Web page" : This will open an eclipse internal browser and show the results the same way.
Let's go back to Apache now: It would be great (and for testing purposes this will be rquired at some stage anyway ) to run our "debugTest" project in any browser outside. For that Apache has to find our project files and teherfore we have to edit the http.conf file which is located at C:\software\xampp\apache\conf\http.conf
Obviously there are many ways to do this I just do some simple configuration using an alias in order to map C:\workspace into the Apache webspace which is :  C:/software/xampp/htdocs
So in the http.conf file add below  "<IfModule alias_module>" the following :
Alias /debugTest C:/workspace/debugTest
<Directory C:/workspace/debugTest>
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
( Here you just may do the same with the directory where you want to install piwigo later :. If you call the eclipse project piwigo in the same workspace as our example put in an alias for  "C:/workspace/piwigo" just as before )
Save, stop and start Apache in the xampp control panel. Open you favorite browser and go to http://localhost/debugTest/hellopiwigo.php You should have the same results as in eclipse. Change, in eclipse, something e.g. "Hello" to "Salut" save and refresh the browser you should see the changes.
Now you can start debugging and play around and explore the debugger view in eclipse. For that right click on "hellopiwigo.php" -> "Debug as" -> "PHP script"
Now i leave it to you to do some more exploration. I will come back with a separate post for getting piwigo going in the dev environment.



#2 2015-05-23 23:21:28


Re: PHP Eclipse developpment environment

Hey I found your guide really nice to follow and well explained but it does not work for me. I do everything exactly like I am told and it seems to work. But when I Run my program as website in eclipse and also in a browser it tells me this:
Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8


#3 2015-05-23 23:26:59

Former Piwigo Team
Lyon (FR)

Re: PHP Eclipse developpment environment

don't expect any answer from starRider who left 5 years ago....

this forum is not the right place for Eclipse support, please find a dedicated forum


  •  » Engine
  •  » PHP Eclipse developpment environment

Board footer

Powered by FluxBB

github twitter newsletter Donate © 2002-2024 · Contact