Remote debug when server receives a request. |
Guru master
|
Is the DebugBreak() statement together with a parameter suitable for what you want to do?
For example, if your PhpED system is IP address 192.168.1.20 then on the web server you could use DebugBreak('1@192.168.1.20') Bear in mind you may have some firewall settings and port forwarding to do, particularly if the web server is on the internet |
||||||||||||
|
Remote debug when server receives a request. |
|
Thanks for the response:
I'll be totally honest and say: I've never even heard of this DebugBreak() function! I've just had a quick skim through the documentation fro PhpED within the IDE's help section and there is no mention there either. I suppose that my next question is: Where is the documentation regarding remote debugging, debugbreak function etc? The only info I can find regarding remote debugging is related to installing the debugger on a remote server, something that I have done successfully based on the documentation. It's from this point on as in 'how to use the remote debugger' set breakpoints etc. I had just assumed that it was exactly the same as debugging on my local WAMP where I have never used such as DebugBreak(). Has anyone produced a book, tutorial etc and how to use the above? (hint for Mr NuSphere) I will continue to research on these 'new to me' DebugBreak in the hope that I can develop a better understanding, any links etc would be greatly appreciated. Thanks again Jonathan |
||||||||||||
|
Guru master
|
The built-in PhpED help is a little incomplete to say the least. I originally found DebugBreak() by typing Debug then ctrl+space to see what Debug commands were available.
DebugBreak is actually mentioned in various places on the NuSphere web site, but I do mean mentioned, it isn't as far as I am aware 'documented'. http://www.nusphere.com/products/php_debugger_advanced.htm A few notes on using DBG and DebugBreak: * It is not an official PHP statement, so if you leave it in your code on a server without NuSphere DBG installed, your code might fail. * Some coding standards disallow use of such statements, due to the possibility of them being accidentally left in the code after release. Using conditionals around such statements can make them much safer. * Opinions vary on whether debuggers (eg NuSphere DBG) should even be present on a production server in a global configuration. I'm of the opinion they should not. Using something like PHP in suExec mode (PHPsuExec) or suPHP means that the site can have its own PHP process and php.ini, which could make it much safer and I would personally be much happier with. * DebugBreak acts as a very forceful break including in situations where maybe PhpED breakpoints won't work. Such situations might include where cookies are not being transferred correctly, maybe due to use of Apache mod_rewrite. * The optional parameter can be debug session information, which can tell NuSphere DBG which debugger client computer to connect to for debugging. PhpED and the PHP DBG Listener must be running on that computer. * Without the parameter, DebugBreak will break back to the already connected PhpED. When you start a normal debug session, you see the session information in the URL, which gives you some idea of the format but can have some variable bits: 409554143122900002@debugger-client-address;d=1,p=0,c=1 So that is the debug session id number followed by optional @debugger-client-address then optional semicolon and various options, such as p=0 or p=1 for the profiler. In a normal debug session the debugger-client-address is normally not used as it defaults to the connected PhpED. Note that it can be an IP address, but from a session on a remote internet server (not on the same LAN) you must use a public IP address (the one from your ISP) and your router will probably have to port forward (normally 7869) to your client computer. Local IP addresses such as 192.168.1.x and 10.0.0.x will not be routed over internet (and in this forum I'm sure some people have indicated they tried that!) DebugBreak takes essentially the same session parameter, although in the case of DebugBreak you might simplify it to just a session id and a debugger-client-address, plus the session id is not actually always critical unless you are running multiple sessions, so can often be specified as something like 1 to give you:
Another useful command that is under-documented is OutputDebugString(), with a single mention in the help for the Log tab, which is where I originally found it after deliberately searching for the existence of such a command. The help doesn't even say it is a PHP statement, plus it doesn't show with command completion and doesn't even turn blue in PhpED to show it's a valid statement. The OutputDebugString('hello') command will output a string to the Log tab, complete with timestamp and without corrupting page display and most usefully before page headers are sent; can be quite handy. Probably should be used with the same safety considerations as for DebugBreak. |
||||||||||||||
|
Remote debug when server receives a request. |
|
First off, Thank You very much for your time in helping me with this issue. You have provided a wealth of information that I will use as a start in my research of PhpED debugging (remote / local).
I will attempt to document my findings hoping that they will help others who follow. I still believe that there is a need for a 'PhpED book' and as PhpED is a very popular IDE that many seem to have documentation issues with (see this forum) I am hopeful that it will not be long before someone takes up the challenge while at the same time potentially make themselves a few thousand dollars. Once again. thanks Jonathan |
||||||||||||
|
Site Admin
|
if you have control over server A requests, just add DBGSESSID into URL that server A sends to server B and place there point that server B would connect to.
If you're behind router, you may want to run ssh tunnel to the server B beforehand. In this case your DBGSESSID will be like below: DBGSESSID=1@localhost localhost is needed here in case of tunnel. Otherwise you'll need real IP address of your client HOST where you run PhpED. |
||||||||||||
_________________ The PHP IDE team |
Remote debug when server receives a request. |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by