How to setup a complete PHP development environment on windows
This article explains how to setup a webserver, Eclipse (IDE), Debugging support (XDEBUG, how to setup breakpoint etc), SVN support on Windows. After following this article, you should be ready to start developing plugins or new features for Piwik, the open source web analytics platform''
UPDATE: You can also try the great tutorial on How To Setup a Free PHP Debugger using Eclipse PDT + XDebug
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
You can change the DocumentRoot value in the httpd.conf file to match your working directory (for example F:/piwik)
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
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"
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
Piwik source code is hosted on Git hub at: https://github.com/piwik/piwik
You can use the GIT plugin in the IDE to easily pull/commit/push from within Eclipse.
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
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.
You should have a fully working IDE with PHP Debugging, SVN support, etc. Any questions?