Revision as of 11:27, 2 December 2010
|
|
Uniform Server Portable PHP IDE.
|
Uniform Server portable PHP IDE
This step-by-step design guide shows how to create a simple portable PHP IDE (integrated development environment).
Included are steps for converting this IDE to run as a Uniform Server plugin. For completeness the guide includes mini tutorials.
Portable PHP IDE Features:
- Self-contained
- Edit PHP CLI scripts
- Debug PHP CLI scripts
- Only Open Source components used
- Includes Notepad++ - Core
- Includes Notepad++ plugin NppExec
- Includes Notepad++ plugin DBGp
|
|
- Portable run from UDB memory stick
- Edit PHP web pages running on local server (Uniform Server)
- Debug PHP web pages running on local server (Uniform Server)
- Easily converted to a Uniform Server plugin
- Includes PHP XDebug - CLI and Server debugging
- Includes PHP 5.3.3 - CLI
- PHP CLI Easily upgraded
|
Background
Some time ago I was asked the following question "Is there an easy way to develop and run PHP CLI scripts from a USB memory stick"?
It transpires this user was learning PHP and wanted an easy way to run code snippets. Reason for running from a USB stick, he/she did not want to install PHP and a full-blown IDE on their PC.
My reply was, use Notepad++ install the NppExec plugin add core binaries from PHP. To run currently displayed script write a small NppExec command script. You can create a shortcut key that runs this command script. For greater flexibility consider adding XDebug which will allow you to debug both CLI and server side scripts.
Response was not unexpected! "Can you supply a complete idiots guide?"
Guide Tutorial Breakdown
This guide is split across several pages each page builds on previous pages to construct the final IDE. Pages and topics covered are as follows:
Page
|
Content
|
Introduction
|
This page
|
Notepad++
|
Step-by-step guide creating IDE folder structure. Install and reduce size of Notepad++ (core component). Batch file to start Notepad++
- Install NppExec plugin - Provides console window
- Install DBGp Plugin - Debugging client and control window
|
Install PHP
|
Install PHP for running CLI scripts. You can decide which version of PHP to use
|
NppExec configuration
|
This page covers the following:
- How to copy and paste in console window.
- Use environment variables for absolute paths to Notepad++'s folders.
- Using the above Environment variables run script currently displayed in Notepad++
- Several commands can be saved as a command list and run collectively.
- A [[PHP PORTABLE IDE: NppExec Configuration#Assign shortcut key | shortcut key] can be assigned to run the above saved command script.
- Output in a console window may be filtered to highlight errors. Double clicking this highlighted text takes you to that line of code in the edit window.
|
PHP extensions
|
This page shows how to enable PHP extensions in the CLI configuration and ensure correct file is being picked up.
- Running CLI scripts the PHP interpreter needs to know what configuration file to use also true when run via a command script.
- Checking correct configuration file is being picked up you can put a dummy line in the configuration file to produce an error or use the PHP info function.
- How to enable PHP extensions using the WinBinder extension as an example.
- Generally when a file is double clicked you expect that file to be run with the correct application. Interestingly this can lead to some confusion especially for PHP files see Double clicking PHP file problem
- Want to preserve file associations for example .php is associated with a PHP editor and you want to run that script on a server when double clicked use a redirection file!
|
Run Menu
|
This page looks at automating functionality using Notepad++ menu system.
- After editing a PHP script it is advisable to run a syntax check. This functionality is assigned to a menu item.
- Similarly running a page on a local web server is assigned to a menu item. This runs a PHP script that indirectly (via a browser) runs a script on a local server. A server may be configured to pass files with any extension hence the PHP redirection makes no distinction.
|
XDebug 1
|
XDebug 1 covers setting up our IDE for PHP CLI debugging using the XDebug extension
- Majority of material seems to be Linux orientated hence a quick overview for Windows users
- Downloading and installing XDebug is very easy.
- To run XDebug a separate [[PHP PORTABLE IDE: Notepad++ XDebug 1#PHP Configuration file | configuration file] specific to PHP CLI is required.
- Similarly configuration of Notepad++’s client plugin is easy requiring only a few mouse clicks.
- Our IDE requires both console and debugging windows to be open however there is an issue when these are docked solution is to undock them.
- Adding a new command script to run PHP CLI debugging requires only minor changes to an existing script.
|
Debugging 1
|
- PHP CLI debugging is covered on this page.
- Debugging overview shows complete sequence for debugging CLI scripts.
- A powerful feature is the ability to change a variable while debugging.
- Interested in tracking a small number of variables then add them as watches.
- How to use Xdebug Break function useful for initiating a break point in included pages.
- Notepad++'s integrated console window may be of limited use for your application alternative is to use an external cmd window for debugging.
|
XDebug 2
|
XDebug 2 covers setting up our IDE for running and debugging PHP web pages using the XDebug extension
- Again majority of material seems to be Linux orientated hence a quick overview for Windows users
- This section covers downloading and installing XDebug on Uniform Server.
- Running XDebug on Uniform Server requires modifications to the PHP configuration file.
- Similarly configuration of Notepad++’s client plugin is easy requiring only a few mouse clicks.
- Our IDE requires both console and debugging windows to be open however there is an issue when these are docked solution is to undock them.
- At this stage you will have noticed duplication between pages XDebug 1 and XDebug 2 this is intentional see Important Commonality.
|
Debugging 2
|
This page provides a recap of material already covered and provides an updated redirect script.
- Recap example. Debuggining initiated useing a browser and from Notepad++
- Add menu items to Context Menu
- Run Script On Server
- Plugin design and what requires changing.
|
Top
Download and Install
After reading this design tutorial why not download either the finished Portable IDE or Plugin.
Download and Install details are provided on this page: Uniform Server PHP IDE
Top
Summary
First page introduces the core component Notepad++
Top