This Drupal Amazon EC2 AMI builds on our first released drupal Ec2 Ami. By adding xdebug and configuring it to work with VIM and output profiles for KCacheGrind or WinCacheGrind to our first Ami release, you can now instantly have a fully ready to go test server for everything from functional testing to performance testing.
All you have to do is run the normal ec2 installation, select the version of drupal you require and hey presto in a couple of minutes you have a fully working test environment with drupal, xdebug and vim all playing nicely together and outputting profiles for KCacheGrind/WinCacheGrind .
For both KCacheGrind / WinCacheGrind you need to download and install locally as they are GUI based.
Its not one of our hardened production server setups, its should not to be used in a production environment.
Technical installation details
The image is based on the standard Amazon FC8 image. On start up it automatically downloads and installs the latest version of Drupal core unless you specify otherwise.
- The AMI ID of the image is: ami-534da83a
- It will install the latest version of Drupal 6.x unless you specify a different core version with the -d parameter.
- So, for example, if you want to create a Drupal 5.x instance:
- ec2-run-instances ami-534da83a -k gsg-keypair -d 5
- The -k parameter is mandatory, as there is no root password so you will have to log in with an ssh key
- Default user name/passwords are both: drupal
Drupal Debugging/testing setup
The PHP xdebug extension is installed and configured to output profiling information in the /mnt/xdebug/profiler/ directory for every request.
Download these files to your local machine and use a program like KCacheGrind (or WinCacheGrind on Windows) to view them.
You should see a list of functions that were called, along with the the time taken by each function and the functions it called, number of calls and lots of other useful statistics and analysis.
This is useful, but slows things down overall quite considerably. If you want to disable it, edit the file /etc/php.d/xdebug.ini and change or remove the line "xdebug.profiler_enable = 1". You can also set it to be enabled only for a specific request; see the comments in xdebug.ini for details.
Vim is installed, along with the DBGp client script from http://www.vim.org/scripts/script.php?script_id=1929 allowing it to act as a debugger for PHP code running on the server. To use this, type "vim" at the shell prompt, press F5, and (within the next 5 seconds) point your web browser at the page you wish to debug, then go back to vim and press Enter.
Now you can step through the code, set breakpoints, monitor variables etc. Instructions are displayed in a help pane in the vim window.
Thanks to john for this one.











