zondag 31 augustus 2008

Which tools to use: PHP/MySQL

For my work I have to work in a few different scenes so to speak. On one hand we have the PHP junkies, on the other hand there's the .NET evangelists. I'm sort of caught in the middle, with a unique vantage point on both sides. I can't say it's pretty all of the time.

After having worked with C# and Microsoft SQL Server 2000/2005 exclusively for a few years, I can honestly say I've gotten spoiled with all sorts of cool productivity tools. Snazzy IDEs, database profilers, query browsers, you probably know the drill. How horrified I was when I saw a co-worker use his souped up notepad clone and phpMyAdmin for all his development! Debugging by putting echo and var_dump statements here and there, refreshing the page and trying again.
I couldn't imagine this was the only way to go with PHP, so I started to search for some Visual Studio/SQL management studio replacements. This is what I came up with so far, still looking for a proper mySQL profiler:

  • Eclipse 3.3 (Europa) : Modular IDE which grew from a mainly Java environment to a multilanguage extendible IDE framework. Apparently it has support for C#. If only I wasn't so stubborn in my almost symbiotic attachment to Visual Studio, I might even switch over completely.
  • WampServer : A Windows-Apache-Mysql-PHP all in one installer. Comes with an easy to use system tray utility for doing mundane tasks like restarting your services, adding Apache aliases and toggling PHP and Apache extensions.
  • MySQL's own tools : Contains an admin tool for user management, backup tools, logging etc.
  • XDebug for PHP 5.2.6 : A debugger plugin for PHP, which works well together with Eclipse. With this plugin you can get visual studio-like debugging going in Eclipse, which gets rid of the ugly 'echo and see if it gets there' debugging. It also offers code-coverage and profiling support, but I haven't had a chance to try that out yet.
For installing Eclipse 3.3 with XDebug support, check out this article on Rob's Notebook.

PS: At the time of writing there is a new version of Eclipse available (3.4, Ganymede). However, the PHP development toolkit doesn't quite work yet on that version.

For logging your queries, try the MySQL Log Monitor application. It's kinda crude, but it comes with source code attached. Customize to your heart's content!