Introduction
This is the third article of a series of blog post called the WIMPinator Chronicles that describe how to setup a PHP development environment for Windows 7 and IIS 7.5.
So far we covered how to install a Wordpress blog and all its dependencies using the WPI (Web Platform Installer). Then we added additional features and extensions to the PHP deployment on Windows for IIS.
In this part I am going to demonstrate how to install PEAR and PHPUnit.
The Series
- Getting a Wordpress blog installed in a jiffy on Windows 7 using the Web Platform Installer
- Adding additional features to PHP
- Installing PEAR and PHPUnit
- Installing Eclipse PDT
- Configuring Eclipse PDT to work with Subversion source control
- Configuring Eclipse to work with Ant build tasks
- Creating a new IIS 7.5 fast CGI web site
- Setting up XDebug with Eclipse and IIS 7.5
- Setting up the Zend Debugger with Eclipse and IIS 7.5
- Configuring Ruby and Watir
- Moving a Wordpress blog from GoDaddy shared hosting to my local debugging system.
Go PEAR
Install Pear to gain access to additional PHP extensions like for example the PHP unit testing framework PHPUnit.
First start the CMD command prompt as Administrator and run Go-Pear.bat. The file is located in the PHP root folder. E.g. C:\Program Files (x86)\PHP.
Figure 1: Run Go-Pear.bat as administrator
Just press enter to confirm that all the default paths are OK.
Figure 2: Confirm the default paths
Say Yes, if you allow access to the php.ini file.
Figure 3: Confirm access to the php.ini file
The following screenshot shows the files that PEAR installed.
Figure 4: Files installed by PEAR
PEAR requires the setting of some environment variables that can be installed by merging the PEAR_ENV.reg file. Double-click it and it will merge the required registry settings.
Figure 5: Warning about access to the Windows registry by PEAR_ENV.reg
Here is a screenshot of the registry merge script.
Figure 6: Registry merge script
Here is the complete text output of the PEAR installation session:
c:\Program Files (x86)\PHP>go-pear
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : system
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : c:\Program Files (x86)\PHP
2. Temporary directory for processing : c:\Program Files (x86)\PHP\t
mp
3. Temporary directory for downloads : c:\Program Files (x86)\PHP\t
mp
4. Binaries directory : c:\Program Files (x86)\PHP
5. PHP code directory ($php_dir) : c:\Program Files (x86)\PHP\p
ear
6. Documentation directory : c:\Program Files (x86)\PHP\d
ocs
7. Data directory : c:\Program Files (x86)\PHP\d
ata
8. User-modifiable configuration files directory : c:\Program Files (x86)\PHP\c
fg
9. Public Web Files directory : c:\Program Files (x86)\PHP\w
ww
10. Tests directory : c:\Program Files (x86)\PHP\t
ests
11. Name of configuration file : C:\windows\pear.ini
12. Path to CLI php.exe : .
1-12, 'all' or Enter to continue: all
Installation base ($prefix) [c:\Program Files (x86)\PHP] :
Temporary directory for processing [$prefix\tmp] :
Temporary directory for downloads [$prefix\tmp] :
Binaries directory [$prefix] :
PHP code directory ($php_dir) [$prefix\pear] :
Documentation directory [$prefix\docs] :
Data directory [$prefix\data] :
User-modifiable configuration files directory [$prefix\cfg] :
Public Web Files directory [$prefix\www] :
Tests directory [$prefix\tests] :
Name of configuration file [C:\windows\pear.ini] :
Path to CLI php.exe [.] :
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : c:\Program Files (x86)\PHP
2. Temporary directory for processing : c:\Program Files (x86)\PHP\t
mp
3. Temporary directory for downloads : c:\Program Files (x86)\PHP\t
mp
4. Binaries directory : c:\Program Files (x86)\PHP
5. PHP code directory ($php_dir) : c:\Program Files (x86)\PHP\p
ear
6. Documentation directory : c:\Program Files (x86)\PHP\d
ocs
7. Data directory : c:\Program Files (x86)\PHP\d
ata
8. User-modifiable configuration files directory : c:\Program Files (x86)\PHP\c
fg
9. Public Web Files directory : c:\Program Files (x86)\PHP\w
ww
10. Tests directory : c:\Program Files (x86)\PHP\t
ests
11. Name of configuration file : C:\windows\pear.ini
12. Path to CLI php.exe : .
1-12, 'all' or Enter to continue:
*WARNING*
We found php.exe under ., it uses an unknown SAPI. PEAR commandline
tool has not been tested with it, if you have a CLI (or CGI) php.exe available,
we strongly recommend using it.
Beginning install...
Configuration written to C:\windows\pear.ini...
Initialized registry...
Preparing to install...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.3.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.0.tar...
installing phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar.
..
installing phar://go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar...
install ok: channel://pear.php.net/Archive_Tar-1.3.3
install ok: channel://pear.php.net/Console_Getopt-1.2.3
install ok: channel://pear.php.net/Structures_Graph-1.0.2
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.9.0
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
******************************************************************************
WARNING! The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<c:\Program Files (x86)\PHP\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.
Would you like to alter php.ini <C:\Program Files (x86)\PHP\php.ini>? [Y/n] : y
php.ini <C:\Program Files (x86)\PHP\php.ini> include_path updated.
Current include path : .;C:\php5\pear
Configured directory : c:\Program Files (x86)\PHP\pear
Currently used php.ini (guess) : C:\Program Files (x86)\PHP\php.ini
Press Enter to continue:
** WARNING! Old version found at c:\Program Files (x86)\PHP, please remove it or
be sure to use the new c:\program files (x86)\php\pear.bat command
The 'pear' command is now at your service at c:\program files (x86)\php\pear.bat
* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under c:\Program Files (x86)\PHP\PEAR_E
NV.reg .
This file creates ENV variables for the current user.
Double-click this file to add it to the current user registry.
Press any key to continue . . .
c:\Program Files (x86)\PHP>
Go PHPUnit
Next we are going to install/deploy PHPUnit (3.4.10) using the PEAR delivery mechanism.
Go to http://www.phpunit.de/ to get the detailed installation instructions.
First, in an Administrator command prompt, type and execute the following three commands:
pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear install phpunit/PHPUnit.
Note: You will see the following PHP Error. I don’t know what it means yet. But it seems to be benign.
Figure 7: Invalid configuration directive error
Figure 8: Adding the pear.phpunit.de channel connection and calling pear install
Here is the output.
c:\Program Files (x86)\PHP>pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
c:\Program Files (x86)\PHP>pear channel-discover pear.symfony-project.com
Adding Channel "pear.symfony-project.com" succeeded
Discovery of channel "pear.symfony-project.com" succeeded
c:\Program Files (x86)\PHP>pear install phpunit/PHPUnit
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, symfony/
AML, use --alldeps to download automatically
phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >= 1.
.1)
phpunit/PHPUnit can optionally use package "pear/Log"
phpunit/PHPUnit can optionally use package "symfony/YAML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
downloading PHPUnit-3.4.10.tgz ...
Starting to download PHPUnit-3.4.10.tgz (254,536 bytes)
.....................................................done: 254,536 bytes
install ok: channel://pear.phpunit.de/PHPUnit-3.4.10
c:\Program Files (x86)\PHP>
Symfony Framework
Besides PHPUnit I am also interested in installing the Symfony framework, which requires a ORM tool like Doctrine or Propel. I read that Symfony is best and most flexible deployed manually without using PEAR. In addition to that it already includes both ORM tools as part of its distribution.
Here is a screenshot of the deployed PHPUnit files and folders.

Figure 9: PHPUnit files in the Explorer
Ausblick
Now we are done deploying PHP core components. Starting with the next article I am going to focus on the development tools.