PHP PORTABLE IDE: Install PHP

From The Uniform Server Wiki
Jump to navigation Jump to search

 

MPG UniCenter

Uniform Server Portable PHP IDE.

Installing PHP

Installing PHP is nothing more than extracting appropriate core binaries and copying them to a folder. That said you have a number of choices such as what version of PHP and extensions to include. Added to this do you want to use VC6 or VC9 binaries?

The choice is yours for this portable development environment I have chosen to use PHP 5.3.3 VC9 binaries. The following provides two methods of downloading and installing these binaries. First method extracts them from Uniform Server 6.0.5-Carbo while the second method is more generic and uses binaries from uk.php.net

Preparation

Create three new folders

In folder c:\us_notepad create three new folders

  • Step A) Create folder C:\us_portable_ide\php_scripts - Will contain your working (development) scripts
  • Step B) Create folder C:\us_portable_ide\unicode\php - Will contain PHP binaries
  • Step C) Create folder C:\us_portable_ide\unicode\php\extensions - Will contain PHP extensions

PHP Install Method 1

This method extracts PHP binaries from Uniform Server 6.0.5-Carbo

  • Download Uniform Server 6.0.5-Carbo from SourceForge
  • Save downloaded file Carbo_6_0_5.exe to folder c:\us_portable_ide_temp (or whatever you named it)
  • Extract Uniform Server double click on Carbo_6_0_5.exe no need to change path just click Extract button.

Step A)

  • Navigate to folder C:\us_portable_ide_temp\UniServer\usr\local\php
  • Copy the following files to folder C:\us_portable_ide\unicode\php
    • php5ts.dll - Core PHP
    • php.exe - CLI exe interface to core PHP component

Note: Above two files are the minimum required

  • For completeness its worth copying these files in addition to the above
    • php-win.exe
    • libmysql.dll
    • ssleay32.dll and libeay32.dll


Step B) For a minimum system there is no need to copy any extensions!

However again for completeness

  • Navigate to folder C:\us_portable_ide_temp\UniServer\usr\local\php\extensions
  • Copy all files to folder C:\us_portable_ide\unicode\php\extensions


Top

PHP Install Method 2

This method extracts PHP binaries from PHP 5.3.3 distribution

  • Download VC9 x86 Thread Safe (2010-Jul-21 20:29:51) from windows.php.net
  • Save downloaded file php-5.3.3-Win32-VC9-x86.zip to folder c:\us_portable_ide_temp (or whatever you named it)
  • Extract PHP right click on php-5.3.3-Win32-VC9-x86.zip click on Extract All click Next and Next again when complete click finish.

Step A)

  • Navigate to folder C:\us_portable_ide_temp\php-5.3.3-Win32-VC9-x86
  • Copy the following files to folder C:\us_portable_ide\unicode\php
    • php5ts.dll - Core PHP
    • php.exe - CLI exe interface to core PHP component

Note: Above two files are the minimum required

  • For completeness its worth copying these files in addition to the above
    • php-win.exe
    • libmysql.dll
    • ssleay32.dll and libeay32.dll


Step B) For a minimum system there is no need to copy any extensions!

However again for completeness

  • Navigate to folder C:\us_portable_ide_temp\php-5.3.3-Win32-VC9-x86\ext
  • Copy all files to folder C:\us_portable_ide\unicode\php\extensions


Top

Configuration file for PHP

For a minimal system PHP does not require a configuration file.

However at some point you will want to load PHP extensions this is achieved using a configuration file. This should not be confused with that supplied with the PHP distribution (php.ini) which is for a web server. We want a CLI (command line interface) specific version.

Crete a new text file named php_cli_ide.ini with the following content and save to folder C:\us_portable_ide\unicode\php

[PHP]
;extension=php_curl.dll
;extension=php_mysql.dll
;extension=php_openssl.dll
;extension=php_winbinder.dll
;extension=php_gd2.dll

extension_dir = "./extensions"
;error_reporting = E_ALL | E_STRICT
error_reporting = E_ALL 
date.timezone = "Europe/London"

Currently all extensions are disabled. To enable an extensions remove the semicolon for example to enable curl

  • Change this line:
    ;extension=php_curl.dll
  • To:
    extension=php_curl.dll

Top

Test Script Location

We have created a working folder c:\us_portable_ide\php_scripts this will contain working and development scripts.

If you prefer use a different name and location.

Note: For portability save your scripts in a folder that resides in or below folder us_portable_ide.

Test Script

Now would be a good time to create a test script. We will use this file for testing the configuration explained on next page.

  • Start notepad++ and type in code shown on right
  • Save the file to folder c:\us_portable_ide\php_scripts name it test.php
<?php
print "Test 123\n";
?>

Top

Clean-up

If you wish delete folder us_portable_ide_temp its no longer required.

Top

Summary

With PHP binaries installed our IDE contains all required components to run PHP CLI scripts. These are run from the integrated console window to achieve this plugin NppExec requires configuring.

Next page covers NppExec plugin configuration.

Top