PHP PORTABLE IDE: Introduction: Difference between revisions

From The Uniform Server Wiki
Jump to navigation Jump to search
(New page: {{Uc nav PHP PORTABLE IDE}} '''''Uniform Server portable PHP IDE''''' This step-by-step design guide shows how to create a simple portable PHP IDE (integrated development environment). I...)
 
(Fix grammatical problems; clarify sentences.)
 
Line 20: Line 20:
     
     
|
|
* Portable run from UDB memory stick
* Portable; run from UDB memory stick
* Edit PHP web pages running on local server (Uniform Server)
* Edit PHP web pages running on local server (Uniform Server)
* Debug PHP web pages running on local server (Uniform Server)
* Debug PHP web pages running on local server (Uniform Server)
Line 32: Line 32:
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''"?  
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.
It transpires this user was learning PHP and wanted an easy way to run code snippets. The reason user had for running from a USB stick, they 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.  
My reply was, use Notepad++, install the NppExec plugin and 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''?"  
The response was not unexpected! "''Can you supply a complete idiots guide''?"  


== Guide Tutorial Breakdown ==
== 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:
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:


{|
{|
Line 72: Line 72:
|
|
This page covers the following:
This page covers the following:
* How to [[PHP PORTABLE IDE: NppExec Configuration#Copy and Paste (console window) | copy and paste]] in console window.
* How to [[PHP PORTABLE IDE: NppExec Configuration#Copy and Paste (console window) | copy and paste]] in the console window.
* Use [[PHP PORTABLE IDE: NppExec Configuration#Environment variables | environment variables]] for absolute paths to Notepad++'s folders.
* Use [[PHP PORTABLE IDE: NppExec Configuration#Environment variables | environment variables]] for absolute paths to Notepad++'s folders.
* Using the above Environment variables [[PHP PORTABLE IDE: NppExec Configuration#Run Script Displayed | run script]] currently displayed in Notepad++
* Using the above Environment variables [[PHP PORTABLE IDE: NppExec Configuration#Run Script Displayed | run script]] currently displayed in Notepad++
Line 82: Line 82:
[[PHP PORTABLE IDE: PHP extensions | PHP extensions]]
[[PHP PORTABLE IDE: PHP extensions | PHP extensions]]
|
|
This page shows how to enable PHP extensions in the CLI configuration and ensure correct file is being picked up.
This page shows how to enable PHP extensions in the CLI configuration and ensure that the correct file is being picked up.
* Running CLI scripts the PHP interpreter needs to know [[PHP PORTABLE IDE: PHP extensions#Update NppExec command script |what configuration file to use]] also true when run via a command script.
* Running CLI scripts, the PHP interpreter needs to know [[PHP PORTABLE IDE: PHP extensions#Update NppExec command script |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 [[PHP PORTABLE IDE: PHP extensions#PHP configuration file - php_cli_ide.ini | dummy line]] in the configuration file to produce an error or use the [[PHP PORTABLE IDE: PHP extensions#PHP INFO | PHP info function]].       
* Checking that correct configuration file is being picked up. You can put a [[PHP PORTABLE IDE: PHP extensions#PHP configuration file - php_cli_ide.ini | dummy line]] in the configuration file to produce an error or use the [[PHP PORTABLE IDE: PHP extensions#PHP INFO | PHP info function]].       
* How to enable PHP extensions using the [[PHP PORTABLE IDE: PHP extensions#Enabling extensions | WinBinder extension]] as an example.
* How to enable PHP extensions using the [[PHP PORTABLE IDE: PHP extensions#Enabling extensions | 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 [[PHP PORTABLE IDE: PHP extensions#Double clicking PHP file problem | Double clicking PHP file problem]]
* 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 [[PHP PORTABLE IDE: PHP extensions#Double clicking PHP file problem | 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 [[PHP PORTABLE IDE: PHP extensions#PHP CLI redirect script | redirection file]]!   
* 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 [[PHP PORTABLE IDE: PHP extensions#PHP CLI redirect script | redirection file]]!   
|-valign="top"
|-valign="top"
|
|
[[PHP PORTABLE IDE: Run Menu | Run Menu]]
[[PHP PORTABLE IDE: Run Menu | Run Menu]]
|
|
This page looks at automating functionality using Notepad++ menu system.
This page looks at automating functionality using the Notepad++ menu system.
* After editing a PHP script it is advisable to run a [[PHP PORTABLE IDE: Run Menu#PHP Syntax check | syntax check]]. This functionality is assigned to a menu item.
* After editing a PHP script, it is advisable to run a [[PHP PORTABLE IDE: Run Menu#PHP Syntax check | syntax check]]. This functionality is assigned to a menu item.
* Similarly running a [[PHP PORTABLE IDE: Run Menu#Run PHP web page on server | page on a local web server]] is assigned to a [[PHP PORTABLE IDE: Run Menu#Edit Notepad++ file shortcuts.xml | menu item]]. This runs a [[PHP PORTABLE IDE: Run Menu#PHP CLI redirect script | 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.  
* Similarly running a [[PHP PORTABLE IDE: Run Menu#Run PHP web page on server | page on a local web server]] is assigned to a [[PHP PORTABLE IDE: Run Menu#Edit Notepad++ file shortcuts.xml | menu item]]. This runs a [[PHP PORTABLE IDE: Run Menu#PHP CLI redirect script | 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.  
|-valign="top"
|-valign="top"
|
|
Line 104: Line 104:
* To run XDebug a separate [[PHP PORTABLE IDE: Notepad++ XDebug 1#PHP Configuration file | configuration file] specific to PHP CLI is required.  
* To run XDebug a separate [[PHP PORTABLE IDE: Notepad++ XDebug 1#PHP Configuration file | configuration file] specific to PHP CLI is required.  
* Similarly [[PHP PORTABLE IDE: Notepad++ XDebug 1#Notepad++ DBGp client configuration | configuration of Notepad++’s client]] plugin is easy requiring only a few mouse clicks.
* Similarly [[PHP PORTABLE IDE: Notepad++ XDebug 1#Notepad++ DBGp client configuration | 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 [[PHP PORTABLE IDE: Notepad++ XDebug 1#Docking Problem | solution]] is to undock them.
* Our IDE requires both console and debugging windows to be open, however there is an issue when these are docked. [[PHP PORTABLE IDE: Notepad++ XDebug 1#Docking Problem | Solution]] is to undock them.
* Adding a [[PHP PORTABLE IDE: Notepad++ XDebug 1#New NppExec script | new command script]] to run PHP CLI debugging requires only minor changes to an existing script.
* Adding a [[PHP PORTABLE IDE: Notepad++ XDebug 1#New NppExec script | new command script]] to run PHP CLI debugging requires only minor changes to an existing script.
|-valign="top"
|-valign="top"
Line 113: Line 113:
* [[PHP PORTABLE IDE: Notepad++ Debugging 1#Debugging overview | Debugging overview]] shows complete sequence for debugging CLI scripts.
* [[PHP PORTABLE IDE: Notepad++ Debugging 1#Debugging overview | Debugging overview]] shows complete sequence for debugging CLI scripts.
* A powerful feature is the ability to [[PHP PORTABLE IDE: Notepad++ Debugging 1#Change Value of a variable | change a variable]] while debugging.
* A powerful feature is the ability to [[PHP PORTABLE IDE: Notepad++ Debugging 1#Change Value of a variable | change a variable]] while debugging.
* Interested in tracking a small number of variables then add them as [[PHP PORTABLE IDE: Notepad++ Debugging 1#Watches | watches]].  
* When interested in tracking a small number of variables, add them as [[PHP PORTABLE IDE: Notepad++ Debugging 1#Watches | watches]].  
* How to use [[PHP PORTABLE IDE: Notepad++ Debugging 1#Xdebug Break function | Xdebug Break function]] useful for initiating a break point in included pages.
* How to use [[PHP PORTABLE IDE: Notepad++ Debugging 1#Xdebug Break function | 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 [[PHP PORTABLE IDE: Notepad++ Debugging 1#Alternative Console Window  | external cmd window]] for debugging.   
* Notepad++'s integrated console window may be of limited use for your application. The alternative is to use an [[PHP PORTABLE IDE: Notepad++ Debugging 1#Alternative Console Window  | external cmd window]] for debugging.   




Line 124: Line 124:
|
|
XDebug 2 covers setting up our IDE for running and debugging PHP web pages using the XDebug extension
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 [[PHP PORTABLE IDE: Notepad++ XDebug 2#Overview | overview]] for Windows users
* Again, the majority of material seems to be Linux orientated, hence a quick [[PHP PORTABLE IDE: Notepad++ XDebug 2#Overview | overview]] for Windows users
* This section covers [[PHP PORTABLE IDE: Notepad++ XDebug 2#XDebug download and install | downloading and installing]] XDebug on Uniform Server.
* This section covers [[PHP PORTABLE IDE: Notepad++ XDebug 2#XDebug download and install | downloading and installing]] XDebug on Uniform Server.
* Running XDebug on Uniform Server requires modifications to the [[PHP PORTABLE IDE: Notepad++ XDebug 2#PHP Configuration file | PHP configuration file]].  
* Running XDebug on Uniform Server requires modifications to the [[PHP PORTABLE IDE: Notepad++ XDebug 2#PHP Configuration file | PHP configuration file]].  
* Similarly [[PHP PORTABLE IDE: Notepad++ XDebug 2#Notepad++ DBGp client configuration | configuration of Notepad++’s client]] plugin is easy requiring only a few mouse clicks.
* Similarly [[PHP PORTABLE IDE: Notepad++ XDebug 2#Notepad++ DBGp client configuration | 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 [[PHP PORTABLE IDE: Notepad++ XDebug 2#Docking Problem | solution]] is to undock them.
* Our IDE requires both console and debugging windows to be open however there is an issue when these are docked [[PHP PORTABLE IDE: Notepad++ XDebug 2#Docking Problem | solution]] is to undock them.
* At this stage you will have noticed duplication between pages XDebug 1 and XDebug 2 this is intentional see [[PHP PORTABLE IDE: Notepad++ XDebug 2#Important Commonality | Important Commonality]].  
* At this stage you will have noticed duplication between pages XDebug 1 and XDebug 2. This is intentional; see [[PHP PORTABLE IDE: Notepad++ XDebug 2#Important Commonality | Important Commonality]].  


|-valign="top"
|-valign="top"
Line 136: Line 136:
|
|
This page provides a recap of material already covered and provides an [[PHP PORTABLE IDE: Notepad++ Debugging 2#New redirection script | updated redirect script]].
This page provides a recap of material already covered and provides an [[PHP PORTABLE IDE: Notepad++ Debugging 2#New redirection script | updated redirect script]].
* Recap example. Debuggining initiated useing a browser and from Notepad++
* Recap example. Debugging initiated using a browser and from Notepad++
* Add menu items to Context Menu
* Add menu items to Context Menu
* Run Script On Server
* Run Script On Server
Line 142: Line 142:


|}
|}
'''''[[#top | Top]]'''''


== Download and Install ==
== Download and Install ==
After reading this design tutorial why not download either the finished Portable IDE or Plugin.
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: Introduction | Uniform Server PHP IDE]]
Download and Install details are provided on this page: [[Uniform Server PHP IDE: Introduction | Uniform Server PHP IDE]]


'''''[[#top | Top]]'''''


== Summary ==
== Summary ==
First page introduces the core component [[PHP PORTABLE IDE: Notepad++ | '''Notepad++''']]  
First page introduces the core component [[PHP PORTABLE IDE: Notepad++ | '''Notepad++''']]  
'''''[[#top | Top]]'''''


----
----

Latest revision as of 12:51, 8 December 2010

 

MPG UniCenter

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. The reason user had for running from a USB stick, they did not want to install PHP and a full-blown IDE on their PC.

My reply was, use Notepad++, install the NppExec plugin and 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.

The 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 the 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 that the 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 that 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 the 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.
  • When interested in tracking a small number of variables, 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. The 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

Debugging 2

This page provides a recap of material already covered and provides an updated redirect script.

  • Recap example. Debugging initiated using a browser and from Notepad++
  • Add menu items to Context Menu
  • Run Script On Server
  • Plugin design and what requires changing.

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


Summary

First page introduces the core component Notepad++