Getting xDebug to work on Zend Server on Windows

General discussion forum for the Zend Server
Post Reply
shahar
Posts: 244
Joined: Mon Oct 06, 2008 12:37 pm
Location: Israel
Contact:

Getting xDebug to work on Zend Server on Windows

Post by shahar » Mon Apr 27, 2009 8:17 am

For those of you who want to use xDebug instead of Zend Debugger, here is how to do it on Windows:

1. Get the latest PHP 5.2.x NTS (non-thread-safe) DLL from here: http://www.xdebug.org/download.php

2. Place this DLL in Zend Server's extension directory - that is usually C:\Program Files\Zend\ZendServer\lib\

3. Open The Zend Debugger configuration file in <Install Dir>\etc\cfg\debugger.ini with a text editor (WordPad or other) and comment out the line starting with 'zend_extension_manager.dir.debugger=...'

Code: Select all

;zend_extension_manager.dir.debugger="C:\Program Files\Zend\ZendServer\lib\debugger"
4. Open php.ini in <Install Dir>\etc\php.ini and do the following:

b. Find the line loading the Zend Extension Manager:

Code: Select all

zend_extension="C:\Program Files\Zend\ZendServer\lib\ZendExtensionManager.dll" 
c. Add the following *before* that line: (yes, xDebug must be loaded before the Zend Extension Manager)

Code: Select all

zend_extension="C:\Program Files\Zend\ZendServer\lib\php_xdebug-2.0.4-5.2.8-nts.dll"
Note: make sure you replace the DLL version (2.0.4-5.2.8) with the actual name of the DLL you downloaded.

5. Save php.ini and restart Zend Server.

xDebug should load (check phpinfo() or the Extensions page - xDebug might appear as "built-in", this is a known issue).

Please note that since xDebug is not one of the supported extensions provided by Zend and since it might create some collitions with other Zend Extensions, we will not provide support for xDebug. If you are having problems with your Zend Server, make sure you disable xDebug or any other custom extensions that were not shipped by Zend before contacting Zend Support.
Shahar Evron <shahar.e@zend.com>
Product Manager, Zend Technologies

schnapsten
Posts: 4
Joined: Thu Oct 27, 2011 10:38 am

Re: Getting xDebug to work on Zend Server on Windows

Post by schnapsten » Tue Nov 15, 2011 10:56 am

I'm running Zend Server CE on Windows. I recently installed Xdebug (so that I could analyse code coverage with PHPUnit), however that stopped Zend from running.
I know this is a regular problem - I've read the solution put forward by Zend,
What other options are there? Has anyone managed to resolve this 'with confidence'?

johansyd
Posts: 7
Joined: Sun Feb 05, 2012 12:55 pm

Re: Getting xDebug to work on Zend Server on Windows

Post by johansyd » Sun Feb 05, 2012 1:27 pm

Xdebug is incompatible with the Zend Optimizer and Zend Studio Debugger extensions. These extensions should be commented out. Zend server will crash if they are active.

see: http://wiki.netbeans.org/HowToConfigureXDebug

I am able to send debug requests to the debugger, but I still don't get any debug session to my Zend Studio.

The xdebug log shows:

Log opened at 2012-02-05 11:51:18
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/test/index.php" language="PHP" protocol_version="1.0" appid="22171" idekey="ECLIPSE_DBGP"><engine version="2.1.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2011 by Derick Rethans]]></copyright></init>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>

Log closed at 2012-02-05 11:51:18


Xdebug.ini:

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_log="/var/log/xdebug.log"
xdebug.idekey=ECLIPSE_DBGP


;xdebug.default_enable=1

-----------------------

I think it might be a problem with how I have set up my Zend studio. I f any one could have a look I would be very happy.

xedbug:

Image

Debug settings:

ImageImage

johansyd
Posts: 7
Joined: Sun Feb 05, 2012 12:55 pm

Re: Getting xDebug to work on Zend Server on Windows

Post by johansyd » Sun Feb 05, 2012 1:55 pm

I have corrected a mistake I made in the path mapping. (The backslash was changed to a forward slash) I also added a secondary path mapping mapping /test to /var/www/test . My project is residing on my local web server.

johansyd
Posts: 7
Joined: Sun Feb 05, 2012 12:55 pm

Re: Getting xDebug to work on Zend Server on Windows

Post by johansyd » Sun Feb 05, 2012 10:43 pm

I just installed Eclipse Indigo with PDT and set it up with the same settings as above. The result was that While Eclipse Indigo had no problems, Zend Studio 9 would wait for the xdebug session, but never receive one. I tried this on a Zend server and it works fine as long as you load the xdebug session before any other zend module. Zend studio 9 is incompatible with xdebug and will not work.

My question is. Why having the xdebug option in the Zend Studio Debug Preferences at all if Xdebug is incompatible with Zend Studio. This can be very missleading. I use Zend studio at work, but others use Eclipse and I just waisted 1 week on trying to find out why I wasn't able to debug scripts on our development server which runs xdebug.

I know. A solution would be to install Zend debugger on the development server, but that would mean that all of the developers in the office would have to use the Zend debugger as well and how can I ever convince them of that when your Zend Studio 9 doesn't have the same debugging capabilities as Eclipse Indigo which is free?

I am sorry to say that you just lost a customer, but I fear you might have lost more then one.

The path mapping was corrected from the earlier one and was now set with forward slashes. I also mapped the script so that I didn't need to edit the "auto generate" option, but let it generate the path.

The new path configuration which I used in both eclipse Indigo and Zend Studio 9 looked like this:

Image

I will go through what happens from the launch until the debugger session ends.

-First I configure the Xdebugger, The server and the PHP Web application Debugger launcher so that I only need to press the debug launcher in the PHP View to launch the script.

-The Debugger fires and I can see that the PHP Web Application is running in my Debug view. The Progress bar is tells me it is waiting for a XDebug session and the progress is locked on 57%.

-The XDebug log is reporting the following:

--------------------------------------------------------

Log opened at 2012-02-05 20:48:26
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/test/index.php" language="PHP" protocol_version="1.0" appid="9092" idekey="ECLIPSE_DBGP"><engine version="2.1.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2011 by Derick Rethans]]></copyright></init>

<- feature_set -i 15 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="15" feature="show_hidden" success="1"></response>

<- feature_set -i 16 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="16" feature="max_depth" success="1"></response>

<- feature_set -i 17 -n max_children -v 30
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="17" feature="max_children" success="1"></response>

<- feature_get -i 18 -n encoding
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="18" feature_name="encoding" supported="1"><![CDATA[iso-8859-1]]></response>

<- feature_get -i 19 -n supports_async
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="19" feature_name="supports_async" supported="1"><![CDATA[0]]></response>

<- stdout -i 20 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="20" success="1"></response>

<- stderr -i 21 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stderr" transaction_id="21" success="0"></response>

-> <stream xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" type="stdout" encoding="base64"><![CDATA[PHByZSBjbGFzcz0neGRlYnVnLXZhci1kdW1wJyBkaXI9J2x0cic+CjxiPmFycmF5PC9iPgogICdhJyA8Zm9udCBjb2xvcj0nIzg4OGE4NSc+PSZndDs8L2ZvbnQ+IDxzbWFsbD5pbnQ8L3NtYWxsPiA8Zm9udCBjb2xvcj0nIzRlOWEwNic+MTwvZm9udD4KICAnYicgPGZvbnQgY29sb3I9JyM4ODhhODUnPj0mZ3Q7PC9mb250PiA8c21hbGw+aW50PC9zbWFsbD4gPGZvbnQgY29sb3I9JyM0ZTlhMDYnPjI8L2ZvbnQ+CiAgMCA8Zm9udCBjb2xvcj0nIzg4OGE4NSc+PSZndDs8L2ZvbnQ+IDxzbWFsbD5pbnQ8L3NtYWxsPiA8Zm9udCBjb2xvcj0nIzRlOWEwNic+MzwvZm9udD4KPC9wcmU+]]></stream>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stderr" transaction_id="21" status="stopping" reason="ok"></response>

Log closed at 2012-02-05 20:48:26

----------------------------------------------------

-The Web browser has already loaded the script as if the debug session was already finished, but the url reports that the session has only started. The url looks like this:

http://localhost/test/index.php?XDEBUG_ ... 4749061634

-I terminate the session from the Debug view after 30 min since the progress bar still shows 57%

-A new browser window pops up and says that the debug session has ended. The Message reads: DEBUG SESSION ENDED

The url displays:

http://localhost/test/index.php?XDEBUG_ ... 4749061634

I also tried out the Debug Helper from Chrome and started the session from the browser which gave quite interesting log output.

-The Browser would continue to load just as if a debug session was started.

-The XDebug log would output the following:

Log opened at 2012-02-05 21:30:40
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/test/index.php" language="PHP" protocol_version="1.0" appid="9088" idekey="XDEBUG_ECLIPSE"><engine version="2.1.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2011 by Derick Rethans]]></copyright></init>

<- feature_set -i 22 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="22" feature="show_hidden" success="1"></response>

<- feature_set -i 23 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="23" feature="max_depth" success="1"></response>

<- feature_set -i 24 -n max_children -v 30
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="24" feature="max_children" success="1"></response>

<- feature_get -i 25 -n encoding
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="25" feature_name="encoding" supported="1"><![CDATA[iso-8859-1]]></response>

<- feature_get -i 26 -n supports_async
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_get" transaction_id="26" feature_name="supports_async" supported="1"><![CDATA[0]]></response>

<- stdout -i 27 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="27" success="1"></response>

<- stderr -i 28 -c 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stderr" transaction_id="28" success="0"></response>


- As you may notice. There is no session key here as the debug session is started from the browser and not from Zend Studio 9.

- Zend Studio 9 on the other side behaves as if nothing is happening, but if i restart the Zend server during the debugging session I will get the following reaction:

A pop-up window will show up informing me of a Debugger Error. And the message will read: Unexpected termination of script, debugging ended.

Post Reply