Difficulties with PHPStorm remote debugging and Zend CE Server

I am developing a site using Zend server and debugging has been working fine on localhost.  However, I just uploaded the site to a remote server to test some functions and I cannot get PHPStorm to debug the remote pages.  My configuration looks correct, so I don't know what else to try.

The server name is "" (no domain associated with it yet).  Port is 80.  (See graphic1)

My local IP is  I've created bookmarklets using this IP.

On the remote Zend server, I've added 192.168.*.* as well as my ISP IP address 96.249.*.* to the zend debugger allowed hosts.  (See graphic2)

Zend debugger is turned on and configured on the server (graphic3).

I even opened up ports 10137, 9000 and 20080 on the server (but not sure I needed to).

A dump of $_SERVER on the remote page shows:

[SERVER_SOFTWARE] => Apache/2.2.22 (Ubuntu)
[DOCUMENT_ROOT] => /var/www
[SERVER_ADMIN] => webmaster@localhost
[SCRIPT_FILENAME] => /var/www/index.php
[REMOTE_PORT] => 53537
[REDIRECT_URL] => /login-check
[REQUEST_URI] => /login-check
[SCRIPT_NAME] => /index.php
[PHP_SELF] => /index.php

So SERVER_NAME and SERVER_PORT match my PHPSTORM configuration.

I then click on "listen for PHP debug connections" in PHPSTORM, then click the bookmark "Debug this page" and then refresh the page I want to debug and... it just refreshes.  PHPStorm never breaks at the first line or any line.  It's as though it never heard to the debug request.

What else is there I can check, or what have I missed??

Comment actions Permalink

Hi Dave,

Not 100% sure about Zend Debugger, but I think it will be the same as with Xdebug -- it's debugger who establishes connection with client (PhpStorm in our case). Therefore you need to open debug port (Settings | PHP | Debug | Zend Debugger | Debug port) in your firewall/router (you may need to setup port forwarding so all connections on that port are forwarded to your PC on your local network)

Comment actions Permalink

That was *such* a great suggestion and I thought surely that was it, but... no joy. :(  I opened the zend debug port on the router (and even took down the firewall), forwarded the port to my local IP, and still same thing -- all web pages simply return without being captured by PHPStorm for debugging.

So I added the following to log.xml to turn on debug logging:

  <category name="#com.jetbrains.php.debug">
       <priority value="DEBUG"/>

After restarting PHPStorm, I try to debug the web page again, but there doesn't seem to be any debug output in the log file (log file is attached).  So.... is there a way to make sure that debug logging is occuring?

How can I check to see what PHPStorm is or is not hearing from the port?  Wouldn't that show up in the logs?

I'm really out of ideas to troubleshoot this and really need to be able to remotelly debug the web pages without going back to the stone age in debugging techniques.

Comment actions Permalink

Hi Dave,

1) After you click "listen for PHP debug connections" in PhpStorm, use any programm to verify that PhpStorm actually listens on that port (be it standard netstat or some 2rd party tool like TcpView or your personal firewall etc)

Here you can see how it look on my KIS 2013

2) Now login to your remote server (SSH, Remote Desktop etc) and try to connect from there to your PC on that port using telnet (e.g. 1) telnet 2) open 10137).
If it say something like "Connecting To xxx.xxx.xxx.xxx... Could not open connection to the host, on port xxx: Connect failed" then something is blocking connection somewhere.
If it will print "Connecting To xxx.xxx.xxx.xxx..." and then does nothing (just hangs like this) then quite possible that connection succeeded (at least this behavior I see when attempting to telnet from one Windows 7 PC to another).

3) Maybe you can turn Zend Debugger logging on (to the most detailed level). It's possible to do for Xdebug, so it may be possible for Zend as well. There you may be able to see if it tries to connect and what IP:PORT it tries to.

No other real idea than that. Maybe dev responsible for PHPDebug will see this thread and share his wisdom ...

Comment actions Permalink

Okay; so using TCPView, I see:
So it looks like PHPStorm is listening on the port correctly.  It should since all this works correctly on localhost with PHPStorm and Zend.

I then logged into the server (Ubuntu) and ran telnet as you suggested and it did connect correctly:  This is what I see:

ubuntu@domU-12-31-39-0A-9C-7C:/var/www$ telnet 10137 Trying Connected to Escape character is '^]'.

Not only that, but now I see the remote connection in TCPView!
So I guess all this means that the actual communcation with PHPStorm via port 10137 is working.  So then it must be Zend debugger on the server?  I'm not sure how to turn on debugging with Zend server but will check into it.

Thanks so much Andriy for your help... really looking forward to resolving this.

Comment actions Permalink

Maybe ... debug session is simply not getting established at all (so Zend Debugger does not know that it need to interrup execution and where breakpoints are)? Try initiating debug session manually (GET parameters): http://kb.zend.com/index.php?View=entry&EntryID=434

Xdebug has xdebug_break() function to manually interrupt execution (basically a breakpoint but via function call instead of actual breakpoint). Does Zend Debugger has anyhing similar?

It's definitely not a path mapping issue, otheriwse you would see at least some messages in the log (at very least that's how it works with xdebug). If the issue is actually with path mappings, then you can try deleting your entry (Settings | PHP | Servers) and let PhpStorm to help set it up when session gets established.

Comment actions Permalink

Okay; definitely on the verge of figuring this out... as per your suggestion I checked the server logs and found this in apache's error.log:

[Zend Debugger] Cannot connect to host

This is just after I did a GET of a webpage using the bookmarklet.... Ohhhhhhhh... no... (light dawning)... just a sec..........

Yes, it works now!  Gawd; it all makes perfect sense.  I had used my private IP ( when creating the bookmarklets, but needed to create them using my public IP (  Of course this public IP is what Zend debugger was going to need to communicate back to my system.

My only consolation is that is was going to break because I did not have port forwarding set up on the router, so I was fated to ask these questions anyway. :)  Thank you so much with your help in solving this!

Please sign in to leave a comment.