Sticky Notes: Setting Up Zend Debugger

http://forums.zend.com/viewtopic.php?f=59&t=962

Installing Zend Debugger on Windows

Postby rbzend on Mon Jun 22, 2009 5:32 pm

This Sticky Note explains how to set up Zend Debugger on Windows. The procedure is based on the default PHP from php.netinstallation.
1. Inspect the phpinfo() output of the server on which you want to install the Zend Debugger (or run php -i if you want to install Zend Debugger for the CLI version of PHP).
Click on the picture to see it without scroll bars:

pre-a.png

phpinfo() before the installation

pre-a.png (65.32 KiB) Viewed 52606 times

You need the following information:
(1) The PHP version (PHP CLI – PHP Version => 5.2.10).
(2) The location of the php.ini file (PHP CLI – Loaded Configuration File => C:\Program Files\PHP\php.ini).
(3) The Thread Safety flag (PHP CLI – Thread Safety => enabled).
(!) Note if you use the Zend Extension Manager (PHP CLI – with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies). The Zend Extension Manager can be installed as part of the Zend Optimizer installation.
2. Download Zend Debugger from the Zend Studio Downloads page. Select Studio Web Debugger and choose the Windows package.
The following is a representation of the archive hierarchy (there is a Zend Debugger DLL for all recent PHP versions):

CODE: SELECT ALL

ZendDebugger-5.2.14RC9-cygwin_nt-i386\
    4_3_x_comp\
            ZendDebugger.dll
    4_4_x_comp\
            ZendDebugger.dll
    5_0_x_comp\
            ZendDebugger.dll
    5_1_x_comp\
            ZendDebugger.dll
    5_2_x_comp\
            ZendDebugger.dll
    5_2_x_nts_comp
            ZendDebugger.dll
    dummy.php
    Inventory.xml
    md5
    README.txt

3. Create a new directory for Zend Debugger. I will use C:\Program Files\PHP\Zend in this Sticky Note. In this directory create a sub-directory for your version of PHP – C:\Program Files\PHP\Zend\php-5.2.x (in my example PHP version is 5.2.10 – see screenshot (1)). The latter is obligatory if you use Zend Extension Manager, but won’t hurt in other cases too.
4. Unpack the relevant version of Zend Debugger into C:\Program Files\PHP\Zend\php-5.2.x. Note, for PHP version 5.2.x we provide both the Thread-Safe version (directory 5_2_x_comp in the archive) and the Non-Thread-Safe version (directory 5_2_x_nts_compin the archive).
5. Open the configuration file (in my example C:\Program Files\PHP\php.ini – see screenshot (2)) for editing.
6. Depending on whether you use Zend Extension Manager (see screenshot (!)), and have Thread Safety enabled (see screenshot (3)), the following lines must be added to the configuration file.
Without Zend Extension Manager and with Thread Safety disabled:

CODE: SELECT ALL

; The section name is optional, but it's always a good idea to add it,
; especially if you are not using a separate file
[Zend]
; This directive needs the full path to the Zend Debugger DLL.
zend_extension="C:\Program Files\PHP\Zend\php-5.2.x\ZendDebugger.dll"

Without Zend Extension Manager and with Thread Safety enabled:

CODE: SELECT ALL

; The section name is optional, but it's always a good idea to add it,
; especially if you are not using a separate file
[Zend]
; This directive needs the full path to the Zend Debugger DLL.
; The "_ts" suffix in the directive name suggests Thread-Safe mode.
zend_extension_ts="C:\Program Files\PHP\Zend\php-5.2.x\ZendDebugger.dll"

With Zend Extension Manager and with Thread Safety disabled:

CODE: SELECT ALL

; The section name is optional, but it's always a good idea to add it,
; especially if you are not using a separate file
[Zend]
; This directive instructs Zend Extension Manager to load Zend Debugger.
; Note that the path given is only the top of the hierarchy.
; Zend Extension Manager adds to this path the running PHP version
; in the form "\php-5.2.x\" and the name of the DLL file "ZendDebugger.dll".
zend_extension_manager.debug_server="C:\Program Files\PHP\Zend"

With Zend Extension Manager and with Thread Safety enabled:

CODE: SELECT ALL

; The section name is optional, but it's always a good idea to add it,
; especially if you are not using a separate file
[Zend]
; This directive instructs Zend Extension Manager to load Zend Debugger.
; Note that the path given is only the top of the hierarchy.
; Zend Extension Manager adds to this path the running PHP version
; in the form "\php-5.2.x\" and the name of the DLL file "ZendDebugger.dll".
; The "_ts" suffix in the directive name suggests Thread-Safe mode.
zend_extension_manager.debug_server_ts="C:\Program Files\PHP\Zend"

7. An additional change needs to be made to allow Zend Studio to communicate with Zend Debugger. You need to specify your Zend Studio machine IP address (or network) in the allowed hosts list. Note that the network mask must be specified in CIDR notation, for example:
255.0.0.0 = /8
255.255.0.0 = /16
255.255.255.0 = /24
255.255.255.248 = /29
255.255.255.255 = /32 (exact match)

CODE: SELECT ALL

; This directive allows Zend Debugger to start a debug session with:
; 127.0.0.1/32 - Zend Studio on the same computer
; 192.168.0.1/32 - Zend Studio on a computer with IP address 192.168.0.1
; 10.0.0.0/8 - Zend Studio on any computer with IP starting with 10.
zend_debugger.allow_hosts=127.0.0.1/32,192.168.0.1/32,10.0.0.0/8
; This directive allows Zend Debugger to expose itself
; upon request (this is used in some service functionality).
; The possible options are:
; never - do not expose (default)
; always - expose to whoever wants to know
; allowed_hosts - expose only if the request comes from an IP listed above
zend_debugger.expose_remotely=always

8. Save the configuration file and restart the web server.
9. Check the phpinfo() output and ensure the following:
– Zend Debugger is listed in the Zend Engine section.
– The Zend Debugger section exists.
– The values of zend_debugger.allow_hosts are correct.
– The value of zend_debugger.expose_remotely is correct.
Click on the picture to see it without scroll bars:

res-a.png

phpinfo() after the installation

res-a.png (48.7 KiB) Viewed 52623 times

10. Copy dummy.php from the downloaded Zend Debugger package to your web server’s document root. It should be accessible from a web browser as http://example.com/dummy.php (this script does not produce any output, but it should not result in the 404 error).
Known Issue
Zend Debugger may not load, crash or produce errors when used in conjunction with some other Zend Engine extensions. The most common examples are Zend Optimizer, Zend Loader, ionCube Loader and XDebug. For Zend Optimizer or Zend Loader it is recommended to use Zend Extension Manager, which will fix these compatibility issues. In case of ionCube Loader and XDebug make sure that Zend Debugger is loaded after these extensions. The loading order is defined by the order of corresponding directives in the configuration files. Therefore, the best approach is to add Zend Debugger directives at the very end of php.ini.

Roman Basayev
Zend Technical Support

User avatar
rbzend

Posts: 516

Joined: Tue Dec 23, 2008 5:03 pm
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s