Home

Documentation

Authors

Reference

Tutorials

FAQ

Administrators

Reference

Troubleshooting

Tutorials

Developers

Reference

Tutorials

Tools

Downloads


Ductile CMS

SIL HOME | CONTACT US

You are here: Documentation > Developers > Tools

Zend Debugger with XAMPP

Note

Below is the text of a message I sent to the ZendNeonGroup list describing how to use the Zend debugger with XAMPP.

Our development group has had the dickens of a time getting Zend Debugger to work using an external debugger on Windows with XAMPP. I believe we've finally figured it out. Okay, it's obvious once you understand the issues, but given the fact that (a) there were three or four of us working on it, (b) it took two weeks, (c) we found a dearth of help on the Internet, and (d) the Zend support person didn't sound optimistic and then seemed to abandon us after the first response to the ticket, it seemed worthwhile to document exactly what we did to make it work. Maybe this will be useful for somebody else. Comments and corrections are welcome.

Here's some information about my system:

  • Windows XP
  • Zend Studio for Eclipse (6.0)
  • XAMPP for Windows 1.6.5
  • Apache 2.2.6
  • PHP 5.2.5

I can't guarantee that these instructions will work for any other set-up (in fact I'm sure they won't work for some other combinations). But if this sounds like you, read on.

For reference, my Zend project is called "cms". My directory structure looks something like this:

C: 
   xampp 
      apache 
         bin 
         conf 
         error 
         [etc.] 
      htdocs 
         cms - my Zend project is located here 
         xampp 
      [etc.] 


Plus a lot of other stuff that hopefully isn't relevant.

Here are the steps:

(1) Check some information from phpinfo:

- Thread Safety: enabled. (If thread safety is not enabled then you probably have a different version of something, and these instructions won't work.)
- Note your loaded configuration file--where the relevant php.ini is located. (Mine is C:\xampp\apache\bin\php.ini. I have several other php.ini files floating around that apparently have other purposes.)
- Note your SERVER_ADDR. (Mine is 127.0.0.1)
- Note your DOCUMENT_ROOT. (Mine is C:\xampp\htdocs.)
- Note your hostname and port. (Mine is localhost:80.)

(2) Download the Zend Debugger zip file from the Zend website and open it. Note the directories that are associated with the various versions of ZendDebugger.dll. Find the one that ends in "5_2_x_comp," and move the associated DLL to the same directory as where the loaded configuration file is located (for me, C:\xampp\apache\bin).

Do NOT use the version associated with "...5_2_x_nts_comp", as that is appropriate only for non-thread-safe situations (nts = "non-thread-safe" for dummies like me for whom this was not obvious!).

(3) From the ZIP file, copy the Dummy.php file into your DOCUMENT_ROOT directory (for me, C:\xampp\htdocs).

(4) Find the php.ini file that is called the "loaded configuration file" (there may be other php.ini files around; make sure you get the right one). Add the following lines:

[Zend Debugger] 
zend_extension_ts = <path to configuration file>/ZendDebugger.dll 
zend_debugger.allow_hosts = <IP addresses> 
zend_debugger.expose_remotely = always 

For instance, I added the following lines:

[Zend Debugger] 
zend_extension_ts = "C:\xampp\apache\bin\ZendDebugger.dll" 
zend_debugger.allow_hosts = 127.0.0.1 
zend_debugger.expose_remotely=always 

Some suggest using:

zend_debugger.allow_hosts = 127.0.0.1/32, 192.168.1.0/16 

That also works for me. I guess it doesn't hurt.

Do NOT use "zend_extension = ..." The instructions at  http://static.zend.com/topics/Debugger-Install.pdf say to use that for versions of PHP >= 5.0. Note, however, that these instructions assume you are using Zend Core; they do not apply to XAMPP.

10 Nov 2008: It appears it is also necessary to remove/comment out any statement like zend_extension_ts = "C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll".

(5) Stop the Apache server if necessary and restart.

At this point Zend Debugger should be activated for remote debugging. Check this by looking in your phpinfo. There should be a section called "Zend Debugger". If not, something is wrong.

Okay, now you should be able to try it out in Zend Studio. The following instructions assume you have a Zend project set up and basically working.

(6) First test internal debugging. Go into Zend Studio. Open up an appropriate PHP file and bring up the PHP Debug perspective. Do Run -> Open Debug Dialog.... Create a PHP Script called "test - internal". Choose PHP executable. Make sure the file is set appropriately (mine looks something like "cms\scripts\mypage.php"). Turn on "Break at first line". You may need to add arguments using the second tab. Hitting Debug should break into the debugger and you should be able to use the stepping buttons to step through the code. Hitting the green "Resume" arrow should display the page in the Browser Output view.

(7) Now for external debugging. Again, choose your file and do Run -> Open Debug Dialog... This time create a PHP Web Page item (right-click and choose New). Give it a name and set the file name. The path should be relative to your directory root (for me it is "cms\scripts\mypage.php"). You may need to UNclick "Auto Generate" (for me that generated the wrong thing), and make sure the second part of the URL is correct. You may also need to add arguments to the URL. The first half should say something like " http://localhost/". Make sure "Break at first line" is checked. Hit Apply and then Debug.

This should bring up an external browser and and also start stepping through the code. When the page is fully generated, the contents will be displayed both in the Browser Output window and in the external browser.


© 2019 SIL International, all rights reserved, unless otherwise noted elsewhere on this page.
This website is powered by Ductile CMS!