How to Configure XDebug Debugger for Zend Studio

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
Follow me

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. For latest updates and blogs, follow us on Twitter. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking. Check out my other blog, Revive-n-Thrive.com
Posted in Debugging. Tagged with , , , .

2 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *