Uniform Server PHP IDE: XDebug Overview: Difference between revisions
(New page: {{nav Uniform Server PHP IDE}} '''''XDebug Overview''''' XDebug is a main building block of the Uniform Server PHP IDE. XDebug along with Notepad++’s debugging client provides debugging...) |
m (Additional cleanup) |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
XDebug is a main building block of the Uniform Server PHP IDE. XDebug along with Notepad++’s debugging client provides debugging capabilities for both CLI scripts and Web Page scripts. | XDebug is a main building block of the Uniform Server PHP IDE. XDebug along with Notepad++’s debugging client provides debugging capabilities for both CLI scripts and Web Page scripts. | ||
XDebug’s versatility allows it to run on a server or from a command line. | XDebug’s versatility allows it to run on a server or from a command line. The debugging architecture differs slightly and this page provides an overview of these different architectures. | ||
== PHP CLI Debugging == | == PHP CLI Debugging == | ||
Line 16: | Line 16: | ||
'''Sequence of events''' | '''Sequence of events''' | ||
* Step A) Run Notepad++. | * Step A) Run Notepad++. | ||
* Step B) Start Notepad++'s client (DBGp plugin) | * Step B) Start Notepad++'s client (DBGp plugin) which opens socket 9000<br>(listens on port 9000) | ||
* Step C) Run script from Notepad++ (Executes PHP interpreter). | * Step C) Run script from Notepad++ (Executes PHP interpreter). | ||
* Step D) Interpreter loads configuration file and loads extensions (php_xdebug.dll) | * Step D) Interpreter loads configuration file and loads extensions (php_xdebug.dll) | ||
Line 28: | Line 28: | ||
'''''Note 1'':''' Debugging is initiated as soon as the interpreter loads XDebug. | '''''Note 1'':''' Debugging is initiated as soon as the interpreter loads XDebug. | ||
'''''Note 2'':''' If the script is initiated from an external source (for example, a batch file), XDebug determines if the script (F) is displayed in Notepad++. If not, it is downloaded. | |||
'''''Note 3'':''' If XDebug starts debugging a new page, that page is downloaded if not already displayed in Notepad++. | |||
'''''Note 3'':''' If XDebug starts debugging a new page that page is | |||
| | | | ||
[[Image:Ide_xdebug_1.gif]] | [[Image:Ide_xdebug_1.gif]] | ||
|} | |} | ||
== Web Page Debugging == | == Web Page Debugging == | ||
Debugging a website running on a local server requires | Debugging a website running on a local server effectively requires a second server and client. This second server and client taps into the primary server and web site to provide debugging and control of that site and server. | ||
The second server is created using a PHP extension (php_xdebug.dll) | The second server is created using a PHP extension (php_xdebug.dll). It seamlessly installs code to provide communication between Apache and a client (Notepad++ with DBGpplugin installed) over port 9000. In addition, code is installed to monitor browser requests arriving on the standard Apache port 80. | ||
{| | {| | ||
|- | |- | ||
Line 50: | Line 48: | ||
* Step A) Start Notepad++. | * Step A) Start Notepad++. | ||
* Step B) Notepad++'s client DBGp plugin opens socket 9000 (listens on port 9000) | * Step B) Notepad++'s client DBGp plugin opens socket 9000 (listens on port 9000) | ||
* Step C) In a browser enter address of PHP page to be debugged. | * Step C) In a browser, enter address of PHP page to be debugged. | ||
* Step D) Browser requests this page from Apache server over port 80 | * Step D) Browser requests this page from Apache server over port 80 | ||
* Step E) Apache runs the PHP interpreter | * Step E) Apache runs the PHP interpreter | ||
Line 61: | Line 59: | ||
* Step I) User uses client for debugging. Commands and data are sent over port 9000 | * Step I) User uses client for debugging. Commands and data are sent over port 9000 | ||
* Step J) Client can instruct XDebug to execute one or more php statements. Your PHP code is executed this may output data over http Port (80) to web browser. | * Step J) Client can instruct XDebug to execute one or more php statements. Your PHP code is executed; this may output data over http Port (80) to web browser. | ||
Line 69: | Line 67: | ||
[[Image:Ide_xdebug_2.gif]] | [[Image:Ide_xdebug_2.gif]] | ||
|} | |} | ||
'''''Note 1'':''' Debugging is initiated from a browser. XDebug determines if the page is displayed in Notepad++ if not | '''''Note 1'':''' Debugging is initiated from a browser. XDebug determines if the page is displayed in Notepad++ and if not, it is downloaded. | ||
'''''Note 2'':''' If XDebug starts debugging a new | '''''Note 2'':''' If XDebug starts debugging a new page, that page is downloaded if not already displayed in Notepad++. | ||
'''''Note 3'':''' During debugging browser shows page loading | '''''Note 3'':''' During debugging, the browser shows page loading | ||
'''''Note 4'':''' After step A) you can directly load, edit and save the page to be debugged. After enabling the debug client at step B) you can set | '''''Note 4'':''' After step A) you can directly load, edit and save the page to be debugged. After enabling the debug client at step B) you can set break points and then imitate a debug session via the browser, Step C. The next page covers this in more detail. | ||
== Summary == | == Summary == | ||
The above block diagrams show the commonality between the two architectures, which are essentially the same. Each uses Notepadd++’s client plugin for debugging. This is covered in detail on the [[Uniform Server PHP IDE: IDE Overview | next page]]. | |||
---- | ---- |
Latest revision as of 18:26, 29 December 2010
Uniform Server PHP IDE : Introduction | XDebug Overview | IDE Overview | PHP CLI | XDebug WinBinder
|
|
Uniform Server PHP IDE. |
XDebug Overview
XDebug is a main building block of the Uniform Server PHP IDE. XDebug along with Notepad++’s debugging client provides debugging capabilities for both CLI scripts and Web Page scripts.
XDebug’s versatility allows it to run on a server or from a command line. The debugging architecture differs slightly and this page provides an overview of these different architectures.
PHP CLI Debugging
Debugging a PHP CLI script requires control of the PHP interpreter and a mechanism to separate script flow and error messages generated. A debugging client must provide unobtrusive communication with the interpreter while allowing a script to run.
The PHP extension php_xdebug.dll seamlessly installs code to provide interpreter control and communication between a client (Notepad++ with DBGp plugin installed in the IDE) and the PHP interpreter over port 9000. Effectively php_xdebug.dll includes a mini server to provide communication with a client.
Sequence of events
Note 2: If the script is initiated from an external source (for example, a batch file), XDebug determines if the script (F) is displayed in Notepad++. If not, it is downloaded.
|
Web Page Debugging
Debugging a website running on a local server effectively requires a second server and client. This second server and client taps into the primary server and web site to provide debugging and control of that site and server.
The second server is created using a PHP extension (php_xdebug.dll). It seamlessly installs code to provide communication between Apache and a client (Notepad++ with DBGpplugin installed) over port 9000. In addition, code is installed to monitor browser requests arriving on the standard Apache port 80.
Sequence of events Assumes Uniform Server running (Apache server running).
|
Note 1: Debugging is initiated from a browser. XDebug determines if the page is displayed in Notepad++ and if not, it is downloaded.
Note 2: If XDebug starts debugging a new page, that page is downloaded if not already displayed in Notepad++.
Note 3: During debugging, the browser shows page loading
Note 4: After step A) you can directly load, edit and save the page to be debugged. After enabling the debug client at step B) you can set break points and then imitate a debug session via the browser, Step C. The next page covers this in more detail.
Summary
The above block diagrams show the commonality between the two architectures, which are essentially the same. Each uses Notepadd++’s client plugin for debugging. This is covered in detail on the next page.