First of all, this was written in reference to WampServer 2.0i and Komodo IDE 5.2.4.37659, and the versions of Apache, PHP, MySQL and other components that come with those packages. Since these distributions change fairly rapidly, some or all of this may be invalid by the time you read through. However, the basic process of setting up the environment should hold true. If you didn’t get it, the first part of the title is just a fun reference to the technology Komodo (dragon), XDebug (or “cross-debug” if using the more archaic description of the symbol) and PEAR (the, at least at first, forbidden fruit… this will make more sense when you read the instructions below).
I am not going to focus too much on the details of installing WampServer or Komodo IDE. There are already good tutorials on this. In my environment, I used all of the default setup options and everything pretty much just worked. Well, pretty much. The one thing I did have to do since I already had IIS7 installed was change the Apache port to 8080 (any unused port will do):
- Run WampServer using the desktop icon and find the system tray icon (may need “Show hidden icons”), click and make sure that it has been Put Online and all services are running
- Click on Apache and then httpd.conf to edit the file; Search for the phrase “Listen 80″ and change it to a different port number (this is also where to change the IP binding if needed)
- Don’t use the shortcuts in the WampServer menu for Localhost and phpMyAdmin anymore because they still point to port 80, just point a browser to http://localhost:8080 (for example)
- I reset all of the services at this point to make sure everything was flushed out and copacetic
The project I am working on was started by a buddy of mine, and he was expecting the MySQL server to have a specific root password. I set this up by following these steps:
- Click the WampServer tray icon, click MySQL and then MySQL Console, hit enter to login using the default root password (blank, but next time whatever you change it to)
- Then execute this command by typing it and hitting enter “SET PASSWORD FOR root@localhost=PASSWORD(‘awesome_password’);” (use your own awesome password)
- Go to the phpMyAdmin directory (C:\WAMP\apps\phpmyadmin3.2.0.1 by default for my installation) and open up the config.inc.php file so we can restore access to the database
- Find “$cfg['Servers'][$i]['password'] = ”;” and changed that to “$cfg['Servers'][$i]['password'] = ‘awesome_password’;” (if you prefer to use a non-root account with privileges, go ahead)
- I reset all of the services at this point to make sure everything was flushed out and copacetic
Alright, now I can connect to MySQL securely, manage the database with phpMyAdmin and view PHP files under my C:\WAMP\www folder. Sounds pretty good, but what about source control integration, syntax highlighting, code completion, visual debugging and all of the other stuff I have come to expect from an IDE that keeps me at peak productivity? Well, even though there are a few options (Zend Studio, Eclipse, Visual Studio with extensions, etc.), I decided to go with Komodo IDE from ActiveState, who are also responsible for cool stuff like Perl and Python implementations for Windows, among other developer goodies. Let’s explore the setup and issues along the way…
Creating the initial project, opening files and being able to see syntax highlighting is straightforward. I had already checked out the files from Subversion into my web root directory using TortoiseSVN (remember, this is just a development environment), so in Komodo I went to File –> New –> Project and created a .kpf file for all the files to be added to. Now I decided I needed integrated source control, so I went to look under Edit –> Preferences –> Source Code Control and happily saw Subversion there along with CVS, Perforce, Bazaar, Git and Mercurial. When I clicked on the node, it notified me I didn’t have the binaries in my path and gave me a download button.
With a little research, I decided to install this version of the SVN binaries because the distribution site said it was compatible with Apache 2.2.9+ and WampServer 2.0i comes with Apache 2.2.11 (not that it was necessary but in case I wanted to play with web access for SVN, at least I’d have the option). As soon as the project was opened again in Komodo it seemed to notice I now had SVN and showed statuses of the files in the project. I could edit and commit. One thing I noticed though was that until I returned to the Preferences dialog and the Subversion node under Source Code Control, progress indicators on each file during the commit would stay on until the IDE was closed instead of when the commit completed. I also just noticed it listed my project file in the changed files list twice. Apparently the UI for this still has a few kinks to work out but it hasn’t broke anything yet.
Now I had access to 4 of the features I wanted, but I still had to figure out how to setup debugging, and this was the trickiest part of the setup. PHP needs an extension to allow integrated debugging, and while Komodo tries to automate the process of this setup the most recent verision of the IDE is distributing a buggy version of the library required. As a disclaimer, I don’t think the following steps are officially supported, so use them at your own risk. All you have to do differently than the normal Komodo debugging setup process is first replace the bad DLL in Komodo’s files:
- From the XDebug distribution download page, get this version of the php_xdebug.dll file (I am not sure if this will be the right DLL for everyone on every system, but this is the one Komodo was looking for during the debugger setup described below… my machine and Windows7 install are x64 but the IDE is x86 and this version from XDebug seems to be working)
- Replace the php_xdebug.dll located at C:\Program Files (x86)\ActiveState Komodo IDE 5\lib\support\php\debugging\5.3\ts-vc6-x86 (or under wherever you installed the IDE)
- With a PHP file open in Komodo, hit the Debug button in the toolbar (small right arrow) to jump into the Perferences window (or go through Edit –> Preferences –> Languages –> PHP)
- Click the Debugger Config Wizard button in the middle of the dialog on the right, then Next
- Browse to C:\WAMP\bin\php\php5.3.0 and select php-cgi.exe (not sure it matters which .exe, but since I wanted to emulate a web environment I figured this was probably my best bet)
- Click Next and leave the “INI file to be copied:” as is, then click Browse to select a “debug environment directory” (in my case, I created a new directory under C:\WAMP\bin\php\php5.3.0 called “debug” for this, I don’t think the exact location matters at all to Komodo)
- Click Next and then Browse to select a location for “Use this extensions directory:” (this is where php_xdebug.dll will be copied, and some forum posts that helped me through this part seemed to suggest using the default “ext” directory was not a good choice, I chose to use my “debug” directory so everything was in one place)
- Click Next until you see Finish, then click Finish and if everything worked you are done! (if not the error messages are actually reasonably helpful to solving the problem)
While not strictly related to this process, I wanted to share the workaround to getting PEAR setup in the environment. PEAR will allow you to discover, download and install additional packages into your PHP environment. Out of the box though, there is a problem with the initial configuration that prevents setup. Follow these steps to complete the process:
- Click the WampServer tray icon, click PHP and then php.ini, look for the string “;phar.require_hash = On” and change it to “phar.require_hash = Off” to enable setup
- Run go-pear.bat from C:\WAMP\bin\php\php5.3.0, you can safely hit enter to accept all of the default settings until the process is complete, then run PEAR_ENV.reg from there
- You can then run the pear.bat (in the same directory) to find packages and change your environment (e.g. “pear” to list all available commands or “pear search cache”)
If you skip step #1, go-pear.bat will fail with an inclusion error. That’s all for now. Happy wamping.
UPDATE: One final tip, some Komodo IDE weirdness (e.g. silently not persisting debug settings) seems to go away when you Run as Administrator. The following is for search engines and trackbacks.
This is the error that you will see if go-pear.bat fails:
phar "C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar" does not have a signaturePHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar on line 1236
Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar on line 1236
And Matt Refghi’s blog is where I found the solution. This is the error you will see if you have the XDebug version problem:
Sorry PHP debugging configuration failed. PHP is configured but is unable to load the debugger extension at C:\wamp\bin\php\php5.3.0\ext\php_xedebug.dll.
This is the forum post where my where my investigation started and this is the ActiveState bug report tracking the issue. Note that they suggest to use XDebug version 2.0.5 but another user points out that there is this bug in XDebug that can be worked around by using the version I linked to.
The Dragon, The Cross and The Forbidden Fruit: Using WampServer (Windows7 / Apache / MySQL behind PHP) with Komodo IDE, XDebug and PEAR
First of all, this was written in reference to WampServer 2.0i and Komodo IDE 5.2.4.37659, and the versions of Apache, PHP, MySQL and other components that come with those packages. Since these distributions change fairly rapidly, some or all of this may be invalid by the time you read through. However, the basic process of setting up the environment should hold true. If you didn’t get it, the first part of the title is just a fun reference to the technology Komodo (dragon), XDebug (or “cross-debug” if using the more archaic description of the symbol) and PEAR (the, at least at first, forbidden fruit… this will make more sense when you read the instructions below).
I am not going to focus too much on the details of installing WampServer or Komodo IDE. There are already good tutorials on this. In my environment, I used all of the default setup options and everything pretty much just worked. Well, pretty much. The one thing I did have to do since I already had IIS7 installed was change the Apache port to 8080 (any unused port will do):
The project I am working on was started by a buddy of mine, and he was expecting the MySQL server to have a specific root password. I set this up by following these steps:
Alright, now I can connect to MySQL securely, manage the database with phpMyAdmin and view PHP files under my C:\WAMP\www folder. Sounds pretty good, but what about source control integration, syntax highlighting, code completion, visual debugging and all of the other stuff I have come to expect from an IDE that keeps me at peak productivity? Well, even though there are a few options (Zend Studio, Eclipse, Visual Studio with extensions, etc.), I decided to go with Komodo IDE from ActiveState, who are also responsible for cool stuff like Perl and Python implementations for Windows, among other developer goodies. Let’s explore the setup and issues along the way…
Creating the initial project, opening files and being able to see syntax highlighting is straightforward. I had already checked out the files from Subversion into my web root directory using TortoiseSVN (remember, this is just a development environment), so in Komodo I went to File –> New –> Project and created a .kpf file for all the files to be added to. Now I decided I needed integrated source control, so I went to look under Edit –> Preferences –> Source Code Control and happily saw Subversion there along with CVS, Perforce, Bazaar, Git and Mercurial. When I clicked on the node, it notified me I didn’t have the binaries in my path and gave me a download button.
With a little research, I decided to install this version of the SVN binaries because the distribution site said it was compatible with Apache 2.2.9+ and WampServer 2.0i comes with Apache 2.2.11 (not that it was necessary but in case I wanted to play with web access for SVN, at least I’d have the option). As soon as the project was opened again in Komodo it seemed to notice I now had SVN and showed statuses of the files in the project. I could edit and commit. One thing I noticed though was that until I returned to the Preferences dialog and the Subversion node under Source Code Control, progress indicators on each file during the commit would stay on until the IDE was closed instead of when the commit completed. I also just noticed it listed my project file in the changed files list twice. Apparently the UI for this still has a few kinks to work out but it hasn’t broke anything yet.
Now I had access to 4 of the features I wanted, but I still had to figure out how to setup debugging, and this was the trickiest part of the setup. PHP needs an extension to allow integrated debugging, and while Komodo tries to automate the process of this setup the most recent verision of the IDE is distributing a buggy version of the library required. As a disclaimer, I don’t think the following steps are officially supported, so use them at your own risk. All you have to do differently than the normal Komodo debugging setup process is first replace the bad DLL in Komodo’s files:
While not strictly related to this process, I wanted to share the workaround to getting PEAR setup in the environment. PEAR will allow you to discover, download and install additional packages into your PHP environment. Out of the box though, there is a problem with the initial configuration that prevents setup. Follow these steps to complete the process:
If you skip step #1, go-pear.bat will fail with an inclusion error. That’s all for now. Happy wamping.
UPDATE: One final tip, some Komodo IDE weirdness (e.g. silently not persisting debug settings) seems to go away when you Run as Administrator. The following is for search engines and trackbacks.
This is the error that you will see if go-pear.bat fails:
phar "C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar" does not have a signaturePHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar on line 1236
Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\wamp\bin\php\php5.3.0\PEAR\go-pear.phar on line 1236
And Matt Refghi’s blog is where I found the solution. This is the error you will see if you have the XDebug version problem:
Sorry PHP debugging configuration failed. PHP is configured but is unable to load the debugger extension at C:\wamp\bin\php\php5.3.0\ext\php_xedebug.dll.This is the forum post where my where my investigation started and this is the ActiveState bug report tracking the issue. Note that they suggest to use XDebug version 2.0.5 but another user points out that there is this bug in XDebug that can be worked around by using the version I linked to.