2. Tools of the Trade Web server solution stack Windows: XAMPP Mac: MAMP Integrated development environment (IDE) Aptana Web browser Firefox + add-ons
3. Step 1: Set up your server MAMP 1.8.3 XAMPP 1.7.1 (older version with PHP 5.2) from Sourceforge: http://sourceforge.net/projects/xampp/files/
4. Step 1: Edit PHP settings Find php.ini MAMP: /Applications/MAMP/conf/PHP5/php.ini XAMPP: c:amppHPhp.ini error_reporting = E_ALL display_errors = On display_startup_errors = on log_errors = on error_log = “/path/to/php_error.log”
5. Step 1: Edit PHP settings Find [xdebug] section towards the end of the file Uncomment the line zend_extension=… by removing the semicolon Add the following parameters after that line: xdebug.remote_enable=1 xdebug.remote_handler="dbgp" xdebug.collect_params=3 xdebug.show_local_vars=On xdebug.dump_globals=On xdebug.show_exception_trace=On xdebug.remote_mode=req xdebug.idekey=default Find [Zend] section Comment the line zend_extension=… by prepending a semicolon
6. Step 1: Verify changes Restart *AMP Get to the php info page (via Devel module or *AMP website)
7. Step 2: Set up Aptana Download and install Aptana Studio from http://www.aptana.org/studio/download (standalone, full installer) Install PDT SDK 2.1.2 Set up your workspace File > New Project… PHP > PHP Project
8. Step 2: Set up Aptana Aptana Studio > Preferences > PHP > Debug > Default Settings group panel Set debugger to Xdebug Click Configure, ensure Xdebug is on port 9000 Click “PHP Executables…”, then “Add…” Add a new PHP executable which points to *AMP’s php executable (/Applications/MAMP/bin/php5/bin/php, c:amppin.. and the php.ini file (/Applications/MAMP/conf/php5/php.ini) Click OK Return to the group panel and verify that the PHP executable is set Restart the server
9. Step 2: Set up Aptana Associate Drupal file extensions as PHP files Preferences > General > Content Types Within Content Types > Text select PHP Content Type and add *.module and *.install Preferences > General > Editors > File Associations Add *.module and *.install extension Under Associated editors selected PHP editor and click Default
10. Step 2: Set up Aptana Add the PHP debug perspective
11. Step 3: Set up Firefox Install Xdebug Helper add-on: https://addons.mozilla.org/en-US/firefox/addon/3960 Toggle Xdebug session Toggle Xdebug profiler
12. Step 3: Set up Firefox Default configuration for add-on should be fine
13. Presto! Ensure Firefox is not working in offline mode Toggle on the Xdebug session Reload the page
14. Printing out variables From PHP: var_dump( $var1[, $var2, $var3, …] ); var_export( $var[, $returnAsString] ); print_r( $var[, $returnAsString] ); From the Devel module: dprint_r() Better formatting of code than print_r() dsm() Print into the messages box “Less likely to wreck your beautiful page layout”
15. Additional Resources About Xdebug Helper Firefox add-on: http://code.google.com/p/syslogr-utils/wiki/XdebugHelper Settings up a debugging environment in Aptana: http://docs.aptana.com/docs/index.php/Developing_with_the_Aptana_PHP_Plugin Xdebug website:http://xdebug.org/