There are some tutorials or blogs on the internet that are already describing “How to setup PEAR package on WAMP environment”, but after following each and every one of them I stumbled upon some errors and misconfiguration.
My configuration was done on WAMP 2.1 environment (with PHP 5.3.5)
1. step: You will need to setup “php.ini” file, the one from “php5.x.x” directory and not the one from “apache/bin”. Find the line:
;phar.require_hash = On
and change it to:
phar.require_hash = Off
Save the file and run “cmd” as Administrator.
2. step: go to PHP working directory in my case:
C:\wamp\bin\php\php5.3.5>
And type:
php -d phar.require_hash=0 PEAR/go-pear.phar
In next steps I used system (I used local at first but “pear” command was not working from command line even tho I set PATH variable) and watch for system paths (I chose “all” and added PEAR in directory name where applicable). Examples:
C:\wamp\bin\php\php5.3.5\PEAR
C:\wamp\bin\php\php5.3.5\PEAR\pear
C:\wamp\bin\php\php5.3.5\PEAR\www
C:\wamp\bin\php\php5.3.5\PEAR\cfg
C:\wamp\bin\php\php5.3.5\PEAR\docs
etc...
After installation is completed got to “php” folder under “PEAR” directory, find “PEAR_ENV.reg” and run it.
Try typing “pear” in command line if you are getting error (try to close current “cmd” and run new one):
'pear' is not recognized as an internal or external command,
operable program or batch file.
If the problem is still present try adding PEAR path manually in Environment Variables under “Path”:
;C:\wamp\bin\php\php5.3.5\PEAR
If “pear” is still not recognized as command try to reinstall PEAR from beginning.
If “pear” is working you should see next result after typing “pear” command:
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-login Connects and authenticates to remote channel server
channel-logout Logs out from the remote channel server
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 [Deprecated in favor of channel-login]
logout Logs out from the remote server [Deprecated in favor of channel-logout]
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
svntag Set SVN Release Tag
uninstall Un-install Package
update-channels Update the Channel List
upgrade Upgrade Package
upgrade-all Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]
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.
* Notice: if you get warnings about Structure_Graph do not worry we will get to that in a second.
3. step:
You can not follow step 3 if “pear” command is not working in your “cmd”!!!
Download [PEAR Structures] and extract its content to PEAR folder. Run “cmd” as Administrator and go to PEAR working directory Then run:
C:\wamp\bin\php\php5.3.5\PEAR>pear install -a Structures_Graph
If everything goes well you should see something like this:
downloading Structures_Graph-1.0.4.tgz ...
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
.........done: 30,318 bytes
install ok: channel://pear.php.net/Structures_Graph-1.0.4
After that upgrade PEAR with next command from same working directory:
C:\wamp\bin\php\php5.3.5\PEAR>pear upgrade PEAR
Well that is all to it. I tried to stress out where I had problem with setting up PEAR package. If you have any further question feel free to ask.