Remote Debugging - PHP

You may enable remote debugging for all scripts by editing the configuration file php.ini, or you may use the debugger_on function, described earlier. Once enabled, PHP will ttempt to connect to a remote host and port each time a script is run.

You will need a port listening program to get the debugging information. There are numerous free port listeners for Windows. I've found Port Listener by Hauke X to work well. Similar programs exist for UNIX as well.

All debugging messages are sent to the listening host, regardless of the error reporting level set in php.ini. Messages are sent in a special format date time host(pid) type:message-data followed by a linefeed.

date time host (pid) type:message-data

The date is in the format YYYY-MM-DD. Time is in the format HH:MM:UUUUUU. The last six digits of time are the seconds and microseconds. The host is the name of the server and pid is the process identifier. The type is a special code described. The rest of the line is a message terminated with a linefeed. Using the remote debugger is as simple as executing a PHP script and watching the debug information appear in the port listener output.


All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

PHP Topics