How to Configure XDebug Debugger for Zend Studio

2

I have tried to configure many a times, Zend studio with XDebug due to various reasonss, most common being my computer getting crashed. And, everytime, I found myself reinventing the wheel after I got exhausted to figure out if I noted the configurations somewhere.

This blog is for me to refer back whenever my laptop crashes again and I have to reconfigure Zend Studio, PHP and XDebug.

Following entities will change:

  1. Downloading of XDebug DLL and placing the same in ext folder of php installation
  2. PHP INI file
  3. Zend Studio Debug Preferences

Lets go over each one of them in detail:

  • Download relevant XDebug dll from thos page. http://xdebug.org/download.php. The downloadable depends upon php version and windows configuration. Mine is 64 bit, PHP 5.3 So, I downloaded http://xdebug.org/files/php_xdebug-2.2.1-5.3-vc9-x86_64.dll. Just FYI, if you try downloading incompatible version, there are chances of exception when you try to start HTTPD. Once downloaded, place the dll file in <PHP_Installation_HOME>/ext
  • Put following configuration in your PHP INI file:

[XDEBUG]
zend_extension=”D:\PHP\ext\php_xdebug-2.2.1-5.3-vc9-x86_64.dll”
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_mode=req

To know more about xdebug remote options, visit the page http://xdebug.org/docs/remote.

  • Do the following with Zend Studio:
a. Access Windows/Preferences in Zend Studio.
b. Go to PHP/Debug
c. In PHP/Debug window, 1. change the debugger to XDebug by selecting from drop down list. 2. change the server configuration to point to your local server. I fixed it to localhost:7001. You do that by clicking on “PHP Servers…” link, and then creating an entry for localhost:7001. Further to that, you click on localhost:7001 and set the information for Base URL and Local Web Root 3.You set the configuration for local php installation. This is done by going within link “PHP Executables…” where you create a new entry and may name it as PHP Local. Then you double click on the new entry and enter the details for following: a> Name b> Executable Path c> PHP ini file d> SAPI Type (select CLI) e> PHP Debugger (select XDebug).
Refer following diagram that represents above:
zendstudio xdebug configuration

zendstudio xdebug configuration

4. There is one additional step that one needs to do. You need to access Windows/Preferences/PHP/Debig/Installed Debuggers and double click on XDebug entry. Once the windows open up select “any” from “Access remote session (JIT)” dropdown.
Once you are done with above steps, you are all set. Shut down Zend studio, and Http server. Restart server and zend studio and try debugging a hello world php file. You should be all set.
Ajitesh Kumar

Ajitesh Kumar

Ajitesh is passionate about various different technologies including programming languages such as Java/JEE, Javascript, PHP, C/C++, mobile programming languages etc, and, computing fundamentals related with cloud-native technologies, application security, cloud computing platforms, mobile apps, big data etc.

He has also authored the book, Building Web Apps with Spring 5 and Angular.
Ajitesh Kumar

2 Comments

  1. Pingback: How to Debug PHP Code? | Software Developer's Cravings

Leave A Reply

Time limit is exhausted. Please reload the CAPTCHA.