SlideShare a Scribd company logo
1 of 15
Debugging Drupal Setting up a local development environment
Tools of the Trade Web server solution stack Windows: XAMPP Mac: MAMP Integrated development environment (IDE) Aptana Web browser Firefox + add-ons
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/
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”
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
Step 1: Verify changes Restart *AMP Get to the php info page (via Devel module or *AMP website)
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
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
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
Step 2: Set up Aptana Add the PHP debug perspective
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
Step 3: Set up Firefox Default configuration for add-on should be fine
Presto! Ensure Firefox is not working in offline mode Toggle on the Xdebug session Reload the page
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”
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/

More Related Content

What's hot

Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8Raja Rozali Raja Hasan
 
Installation of Drupal on Windows XP with XAMPP
Installation of Drupal on Windows XP with XAMPPInstallation of Drupal on Windows XP with XAMPP
Installation of Drupal on Windows XP with XAMPPRupesh Kumar
 
8 Web Practices for Drupal
8  Web Practices for Drupal8  Web Practices for Drupal
8 Web Practices for DrupalWingston
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Boxguest34a3a419
 
Installation of Drupal on Windows XP
Installation of Drupal on Windows XPInstallation of Drupal on Windows XP
Installation of Drupal on Windows XPRupesh Kumar
 
Installing symfony within netbeans and WAMP
Installing symfony within netbeans and WAMPInstalling symfony within netbeans and WAMP
Installing symfony within netbeans and WAMPRiyad Bin Zaman
 
How to Install Magento 2 on XAMPP Server localhost.
How to Install Magento 2 on XAMPP Server localhost.How to Install Magento 2 on XAMPP Server localhost.
How to Install Magento 2 on XAMPP Server localhost.Web Visitors
 
Ilias 4 # clients - On shared hosting with cPanel
Ilias 4 # clients - On shared hosting with cPanelIlias 4 # clients - On shared hosting with cPanel
Ilias 4 # clients - On shared hosting with cPanelleer_thuiz_com
 
Installation instruction of Testlink
Installation instruction of TestlinkInstallation instruction of Testlink
Installation instruction of Testlinkusha kannappan
 
PHP on Google App Engine
PHP on Google App EnginePHP on Google App Engine
PHP on Google App Enginetim4h0blyn
 
Build website in_django
Build website in_django Build website in_django
Build website in_django swee meng ng
 
Introduzione ai test automatici con PHPunit
Introduzione ai test automatici con PHPunitIntroduzione ai test automatici con PHPunit
Introduzione ai test automatici con PHPunitFabio Giannese (Diodœ)
 
The Critical Path for Startups
The Critical Path for StartupsThe Critical Path for Startups
The Critical Path for StartupsMichael Herlache
 
Installation of Joomla on Windows XP
Installation of Joomla on Windows XPInstallation of Joomla on Windows XP
Installation of Joomla on Windows XPRupesh Kumar
 
Instruction Sheet to Setup CI
Instruction Sheet to Setup CIInstruction Sheet to Setup CI
Instruction Sheet to Setup CIvodQA
 
Installing php and my sql locally using xampp
Installing php and my sql locally using xamppInstalling php and my sql locally using xampp
Installing php and my sql locally using xampppeyman Ghader Kurehpaz
 

What's hot (20)

Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8
 
Installation of Drupal on Windows XP with XAMPP
Installation of Drupal on Windows XP with XAMPPInstallation of Drupal on Windows XP with XAMPP
Installation of Drupal on Windows XP with XAMPP
 
8 Web Practices for Drupal
8  Web Practices for Drupal8  Web Practices for Drupal
8 Web Practices for Drupal
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Box
 
Installation of Drupal on Windows XP
Installation of Drupal on Windows XPInstallation of Drupal on Windows XP
Installation of Drupal on Windows XP
 
Installing symfony within netbeans and WAMP
Installing symfony within netbeans and WAMPInstalling symfony within netbeans and WAMP
Installing symfony within netbeans and WAMP
 
How to Install Magento 2 on XAMPP Server localhost.
How to Install Magento 2 on XAMPP Server localhost.How to Install Magento 2 on XAMPP Server localhost.
How to Install Magento 2 on XAMPP Server localhost.
 
Ilias 4 # clients - On shared hosting with cPanel
Ilias 4 # clients - On shared hosting with cPanelIlias 4 # clients - On shared hosting with cPanel
Ilias 4 # clients - On shared hosting with cPanel
 
Laravel error
Laravel errorLaravel error
Laravel error
 
Installation instruction of Testlink
Installation instruction of TestlinkInstallation instruction of Testlink
Installation instruction of Testlink
 
PHP on Google App Engine
PHP on Google App EnginePHP on Google App Engine
PHP on Google App Engine
 
Build website in_django
Build website in_django Build website in_django
Build website in_django
 
Introduzione ai test automatici con PHPunit
Introduzione ai test automatici con PHPunitIntroduzione ai test automatici con PHPunit
Introduzione ai test automatici con PHPunit
 
The Critical Path for Startups
The Critical Path for StartupsThe Critical Path for Startups
The Critical Path for Startups
 
CakePHP and AJAX
CakePHP and AJAXCakePHP and AJAX
CakePHP and AJAX
 
Installation of Joomla on Windows XP
Installation of Joomla on Windows XPInstallation of Joomla on Windows XP
Installation of Joomla on Windows XP
 
Flask
FlaskFlask
Flask
 
Instruction Sheet to Setup CI
Instruction Sheet to Setup CIInstruction Sheet to Setup CI
Instruction Sheet to Setup CI
 
Apache
ApacheApache
Apache
 
Installing php and my sql locally using xampp
Installing php and my sql locally using xamppInstalling php and my sql locally using xampp
Installing php and my sql locally using xampp
 

Similar to Setting up a debugging environment for Drupal

An Introduction to Xdebug for WordPress
An Introduction to Xdebug for WordPressAn Introduction to Xdebug for WordPress
An Introduction to Xdebug for WordPressKayleigh Thorpe
 
PHP: Debugger, Profiler and more
PHP: Debugger, Profiler and morePHP: Debugger, Profiler and more
PHP: Debugger, Profiler and moreVõ Duy Tuấn
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress developmentSteve Mortiboy
 
Getting started with PHPUnit
Getting started with PHPUnitGetting started with PHPUnit
Getting started with PHPUnitKhyati Gala
 
How to configure PHP with IIS or Apache on Windows
How to configure PHP with IIS or Apache on WindowsHow to configure PHP with IIS or Apache on Windows
How to configure PHP with IIS or Apache on WindowsRizban Ahmad
 
PHP Error installing During Magento 2
PHP Error installing During Magento 2PHP Error installing During Magento 2
PHP Error installing During Magento 2Tecstub
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsDECK36
 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestJoshua Warren
 
Drupal Development w/ PhpStorm and Xdebug
Drupal Development w/ PhpStorm and XdebugDrupal Development w/ PhpStorm and Xdebug
Drupal Development w/ PhpStorm and XdebugChris Haynes
 
Doc quickinstall 3.x
Doc quickinstall 3.xDoc quickinstall 3.x
Doc quickinstall 3.xsetankecos
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows BoxJayanta Dash
 
PHP tutorials , php tutorials for beginners , tutorials for php
PHP tutorials , php tutorials for beginners , tutorials for phpPHP tutorials , php tutorials for beginners , tutorials for php
PHP tutorials , php tutorials for beginners , tutorials for phpaimaq9a
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$Joe Ferguson
 

Similar to Setting up a debugging environment for Drupal (20)

PHP
PHPPHP
PHP
 
An Introduction to Xdebug for WordPress
An Introduction to Xdebug for WordPressAn Introduction to Xdebug for WordPress
An Introduction to Xdebug for WordPress
 
PHP: Debugger, Profiler and more
PHP: Debugger, Profiler and morePHP: Debugger, Profiler and more
PHP: Debugger, Profiler and more
 
Phalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil ConferencePhalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil Conference
 
Getting started with WordPress development
Getting started with WordPress developmentGetting started with WordPress development
Getting started with WordPress development
 
Getting started with PHPUnit
Getting started with PHPUnitGetting started with PHPUnit
Getting started with PHPUnit
 
How to configure PHP with IIS or Apache on Windows
How to configure PHP with IIS or Apache on WindowsHow to configure PHP with IIS or Apache on Windows
How to configure PHP with IIS or Apache on Windows
 
PHP Error installing During Magento 2
PHP Error installing During Magento 2PHP Error installing During Magento 2
PHP Error installing During Magento 2
 
Php Debugger
Php DebuggerPhp Debugger
Php Debugger
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWest
 
Drupal Development w/ PhpStorm and Xdebug
Drupal Development w/ PhpStorm and XdebugDrupal Development w/ PhpStorm and Xdebug
Drupal Development w/ PhpStorm and Xdebug
 
Doc quickinstall 3.x
Doc quickinstall 3.xDoc quickinstall 3.x
Doc quickinstall 3.x
 
Mantis Installation for Windows Box
Mantis Installation for Windows BoxMantis Installation for Windows Box
Mantis Installation for Windows Box
 
Phalcon - Giant Killer
Phalcon - Giant KillerPhalcon - Giant Killer
Phalcon - Giant Killer
 
PHP tutorials , php tutorials for beginners , tutorials for php
PHP tutorials , php tutorials for beginners , tutorials for phpPHP tutorials , php tutorials for beginners , tutorials for php
PHP tutorials , php tutorials for beginners , tutorials for php
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 

Recently uploaded

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Setting up a debugging environment for Drupal

  • 1. Debugging Drupal Setting up a local development environment
  • 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/