Uniform Server PHP IDE: IDE Overview
Uniform Server PHP IDE : Introduction | XDebug Overview | IDE Overview | PHP CLI | XDebug WinBinder
|
|
Uniform Server PHP IDE. |
PHP IDE Overview
Notepad++ is Uniform Server PHP IDE‘s main component. This is an excellent text editor and is well supported. Notepad++ has a wide range of easily installed plugins. Our IDE uses the following two plugings DBGp and NppExec. The XDebug client DBGp interfaces to the PHP Debug module providing interactive control for debugging. An integrated console window and command scripting are provided by NppExec.
This overview covers the user interface, main debugging elements and menu options.
IDE User interface
The IDE user interface consists of three windows: Edit Window:
|
Note:
You can resize and rearrange windows position as appropriate.
IDE uses four command scripts that perform the following functions:
A) Check PHP Syntax | Check syntax of currently displayed PHP script in edit window. Results are displayed in console window. Double clicking on any highlighted errors scrolls the edit window and highlights corresponding line in error. |
B) Run as PHP CLI | Execute currently displayed PHP script using the PHP interpreter. Results displayed in console window. |
C) Run PHP CLI Debug | Execute currently displayed PHP script using the PHP interpreter configured for debugging. Debugging results displayed in debug window. Script results displayed in console window. |
D) Run Script On Server | Run currently displayed PHP web page on server. Script is first saved and default browser redirected to page on server. Page is displayed in browser. |
Command scripts are run using either the macro drop-down menu or context menu shown below:
Context menu:
|
|
Macro drop-down menu:
|
Debug Window Overview
At first sight the debugger looks intimidating, however it really is easy to use. Start the IDE by running Run_IDE.bat
- Located in folder <whatever path you used>/us_portable_php_ide - Portable installation
- Or located in folder <whatever path you used>/UniServer\us_portable_ide - Plugin installation
Open test file debug_test.php (contained in folder php_scripts) in Notepad++ edit window and follow the instructions below to debug.
Note: Script output and errors are displayed in the console window |
Change Value of a variable
After running up to a break-point and before continuing you may want to change a variable’s value.
Set a variable as follows
|
Watches
The list of variables displayed in the Local Context may become large, obscuring a variable you want to constantly monitor.
Ideally you want to directly monitor a few variables; this is achieved by using the Watches window. Add variables as appropriate to this window.
Add Watch
Delete Watch
|
Xdebug Break function
For debugging you must set at least one break point. A default break point is set on first line of a script when the debugger starts.
This is suitable for most debugging applications, but sometimes you want to start debugging in another page that is called from your main script.
Disable default break point
How to disable
For debugging to take place, either manually set a break point in a page |
Add xdebug_break() to a page
You can add the xdebug_break() to any location in a page and break at that point
For example
Note: No variables displayed in local context window. |
<?php $a=10; $b=20; $c=$a+$b; print "Result = $c\n"; xdebug_break() ; print "Debug Test $a\n"; print "Debug Test $b\n"; ?> |
Alternative Console Window
Notpad++’s integrated console window is ideal for running and testing scripts that use standard I/O. However being integrated there are limitations hence on occasions you may want to use a real command window (console cmd). This is achieved by running a batch file that in turn runs a PHP CLI script.
Following demonstrates this technique using our test script debug_test.php
Batch file
|
mode con:cols=65 lines=20 TITLE UNIFORM SERVER - Debug Test COLOR B0 @echo off cls ..\unicode\php\php.exe -c ..\unicode\php\php_cli_ide_debug.ini debug_test.php pause |
Debug
The batch file runs our test script debug_test.php and any output or input is directed to the batch file command window. The script is debugged using Notepad++ however in this scenario the internal console window is not used.
|
Summary
The above has shown how to install the Uniform Server IDE.
Next page looks at running PHP CLI scripts on this IDE.