How to setup a complete PHP development environment on windows
This article explains how to setup a webserver, Eclipse (IDE), Debugging support (breakpoint and stuff), SVN support on Windows
Web Server
You need php5 + Mysql + Apache 2
Download EasyPHP-2.0b1-setup.exe on http://garr.dl.sourceforge.net/sourceforge/quickeasyphp/EasyPHP-2.0b1-setup.exe
Install it.
You can change the DocumentRoot value in the httpd.conf file to match your working directory (for example F:/piwik)
IDE Eclipse
You now need to get eclipse with PHP support.
Download Eclipse + PHP = PDT pdt-all-in-one-incubation-S20070910_RC1-win32.zip on http://download.eclipse.org/tools/pdt/downloads/?release=S20070910-RC1
Unzip
PHP Debugger Xdebug
You need to download the Xdebug DLL for windows
php Debugger = XDebug php_xdebug-2.0.2-5.2.5.dll on http://www.xdebug.org/files/php_xdebug-2.0.2-5.2.5.dll
Copy the DLL in C:\Program Files\EasyPHP 2.0b1\php5\ext
Rename in php_xdebug.dll
Add at the end of your php.ini the following lines
zend_extension_ts="C:\Program Files\EasyPHP 2.0b1\php5\ext\php_xdebug.dll"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=default
Restart Apache
Check that the apache error.log doesn't contain any error message
Check that a "<?php phpinfo(); ?>" displays a box "xdebug" somewhere in the phpinfo output
SVN support
You need SVN support to checkout files from the piwik svn repository.
Install Subclipse found on http://subclipse.tigris.org/install.html
Final touch
Customize your environment by changing values in Window > Preferences > PHP
In piwik all source code files are using the UTF8 charset!
Create a new project (File > New > Project > SVN > Checkout the project from http://dev.piwik.org/svn/trunk)
Testing your environment
Try to debug:
- set a breakpoint in index.php
- Run > Open Debug Dialog
- if needed, select "PHP Web Page" and click on "New launch configuration"
- Server debugger = Xdebug
- File > Browse the index.php to be debugged
- Url > Unclick Auto generate > write the URL to the index.php
- Click Debug, it should load a new page in Firefox and it should trigger the breakpoint in Eclipse
Screenshots
Screenshot of IDE eclipse with php support
Screenshot of IDE eclipse with php support + XDEBUG debug feature enabled. The eclipse php debug feature is very very useful!!
You can display variables values, look at the backtrace, breakpoint anywhere, launch firefox automatically from eclipse to start debugging.
Conclusion
You should have a fully working IDE with PHP Debugging, SVN support, etc. Any questions?
Attachments
- eclipse-preview.jpg (138.2 kB) -
Preview of the working eclipse IDE with php support
, added by matt on 01/12/08 17:37:23. - eclipse-debugging-preview.jpg (144.0 kB) -
Preview of the debugging process in php in eclipse with XDEBUG
, added by matt on 01/12/08 17:41:35.


