wiki:HowToSetupDevelopmentEnvironmentWindows

Update 2014: all Piwik developers use Phpstorm software, as it's simply the best available (though it's not open source!)

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

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

xdebug.remote_autostart=1

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

Git support

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.

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

Preview of the working eclipse IDE 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.

Preview of the debugging process in php in eclipse with XDEBUG

Conclusion

You should have a fully working IDE with PHP Debugging, SVN support, etc. Any questions?

Last modified 3 weeks ago Last modified on Oct 3, 2014 12:26:10 PM

Attachments (2)

Download all attachments as: .zip