This procedure will explain step by step how to install PEAR for PHP and packages in Windows on WampServer.
Download and install the latest version of the WAMP Server. This is the Windows AMP (Apache, MySQL & PHP) package, but the results should be equal if you use another one, like XAMPP for example.
During the installation, use the default paths proposed the by installer: "C:\wamp, C:\wamp\www, etc. The default paths will be referenced in this procedure, change the paths as needed, make note of where in the procedure they are different.
Enter "C:\wamp\php, and locate and execute the file go-pear.bat.
A command prompt window will be opened with the following message; press Enter to proceed.
Afterward, a list of up to 10 (this length may differ on XAMPP and others) filesystem locations will be displayed. Once again press Enter.
Then it will ask if we want to modify php.ini; Type in the letter "Y" and press Enter.
To view this modification check the
end of the php.ini (located in C:\wamp\php) and you should
see:
;***** Added by
go-pear
include_path=.;C:\wamp\php\pear
;*****
Next you will be notified that the include_path was updated. Press Enter to continue.
A final message announces that a file called PEAR_ENV.reg has been created, which, upon execution, will add some Windows environment variables.
Enter "C:\wamp\php" and double click the file called "PEAR_ENV.reg". When asked to confirm the addition of registry values choose "Yes" and then click "OK".
Following is an example of what
should typically appear on the command line interface for the above
steps:
C:\Documents and Settings>cd ..
C:\>cd
wamp\bin
C:\wamp\bin>cd
php\php5.2.6
C:\wamp\bin\php\php5.2.6>go-pear.bat
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:\wamp\bin\php\php5.2.6
2. Temporary directory for
processing : C:\wamp\bin\php\php5.2.6\tmp
3. Temporary directory
for downloads : C:\wamp\bin\php\php5.2.6\tmp
4. Binaries directory
: C:\wamp\bin\php\php5.2.6
5. PHP code directory ($php_dir) :
C:\wamp\bin\php\php5.2.6\pear
6. Documentation directory :
C:\wamp\bin\php\php5.2.6\pear\docs
7. Data directory :
C:\wamp\bin\php\php5.2.6\pear\data
8. Tests directory :
C:\wamp\bin\php\php5.2.6\pear\tests
9. Name of configuration file
: C:\WINDOWS\pear.ini
10. Path to CLI php.exe :
C:\wamp\bin\php\php5.2.6\.
1-10, 'all' or Enter to
continue:
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.2.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.6.1.tar...
installing
phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar.
..
pear/PEAR
can optionally use package "pear/XML_RPC" (version >=
1.4.0)
install ok:
channel://pear.php.net/Archive_Tar-1.3.2
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/PEAR-1.7.1
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:\wamp\bin\php\php5.2.6\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:\wamp\bin\php\php5.2.6\php.ini>? [Y/n] :
y
php.ini
<C:\wamp\bin\php\php5.2.6\php.ini> include_path
updated.
Current include path : .;C:\php5\pear
Configured
directory : C:\wamp\bin\php\php5.2.6\pear
Currently used php.ini
(guess) : C:\wamp\bin\php\php5.2.6\php.ini
Press Enter to
continue:
** WARNING! Old version found at
C:\wamp\bin\php\php5.2.5, please remove it or be sure to use the
new
c:\wamp\bin\php\php5.2.6\pear.bat command
The 'pear'
command is now at your service
at
c:\wamp\bin\php\php5.2.6\pear.bat
** The 'pear' command is
not currently in your PATH, so you need to
** use
'c:\wamp\bin\php\php5.2.6\pear.bat' until you have added
**
'C:\wamp\bin\php\php5.2.6' to your PATH environment variable.
Run
it without parameters to see the available actions, try 'pear list'
to see what packages are installed, or 'pear help' for help.
For
more information about PEAR,
see:
http://pear.php.net/faq.php
http://pear.php.net/manual/
Thanks
for using go-pear!
* WINDOWS ENVIRONMENT VARIABLES *
For
convenience, a REG file is available
under
C:\wamp\bin\php\php5.2.6\PEAR_ENV
.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:\wamp\bin\php\php5.2.6>
In C:\wamp\php, copy the file pear.bat to C:\WINDOWS\system32. Alternatively you can add C:\wamp\php to your windows PATH environment variable to expose this file globally.
Next open the run dialog and type cmd to open a command prompt window.
Type pear to see all available commands and verify proper installation. If this command is unrecognized you will have to review the previous steps and repeat anything you missed.
Output of command line screen of a working installation:
Microsoft Windows XP [Version
5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents
and Settings\Administrator>cd c:\
C:\>pear
Commands:
build
Build an Extension From C Source
bundle Unpacks a Pecl
Package
channel-add Add a Channel
channel-alias Specify an
alias to a channel name
channel-delete Remove a Channel From the
List
channel-discover Initialize a Channel from its
server
channel-info Retrieve Information on a
Channel
channel-update Update an Existing Channel
clear-cache
Clear Web Services Cache
config-create Create a Default
configuration file
config-get Show One Setting
config-help Show
Information About Setting
config-set Change Setting
config-show
Show All Settings
convert Convert a package.xml 1.0 to package.xml
2.0 format
cvsdiff Run a "cvs diff" for all files in a
package
cvstag Set CVS Release Tag
download Download
Package
download-all Downloads each available package from the
default channel
info Display information about a package
install
Install Package
list List Installed Packages In The Default
Channel
list-all List All Packages
list-channels List Available
Channels
list-files List Files In Installed Package
list-upgrades
List Available Upgrades
login Connects and authenticates to remote
server
logout Logs out from the remote server
makerpm Builds an
RPM spec file from a PEAR package
package Build
Package
package-dependencies Show package
dependencies
package-validate Validate Package Consistency
pickle
Build PECL Package
remote-info Information About Remote
Packages
remote-list List Remote Packages
run-scripts Run
Post-Install Scripts bundled with a package
run-tests Run
Regression Tests
search Search remote package database
shell-test
Shell Script Test
sign Sign a package distribution file
uninstall
Uninstall Package
update-channels Update the Channel List
upgrade
Upgrade Package
upgrade-all Upgrade All Packages
Usage: pear
[options] command [command-options]
Type "pear help options"
to list all options.
Type "pear help shortcuts" to list
all command shortcuts.
Type "pear help " to get the help
for the specified command.
C:\>
Next update the memory_limit property value to 64M in php.ini. This will help php script execution. This file is found in "C:\wamp\php\php.ini and C:\wamp\Apache2\bin\php.ini update both.
Now re-initiate the services/processes through WAMP.