|
Can WAMP run code and classes from PEAR packages? Yes, it can. This article shows how to install PEAR on a server running WampServer 2.0g-1, released in March 2009.
Make backup copies of the php.ini file in the Apache bin folder and the PHP folder.
Go to the DOS command prompt and change current directory to C:\wamp\bin\php\php5.2.9-1.
Run the batch file go-pear.bat.
Select to install a local copy of PEAR and confirm.
You get 12 options for locations. Press Enter to accept the locations.
Here is what the installation will display. Please note that the installer selected to edit the php.ini file manually, as shown at the bottom of this page.
= = = = = = = = Start Of Display = = = = = = = = = = =
Beginning install...
Configuration written to C:\wamp\bin\php\php5.2.9-1\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.7.2.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.2
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:
Would you like to alter php.ini <C:\wamp\bin\apache\apache2.2.11\bin\php.ini>? [Y
/n] : n
Please look over your php.ini file to make sure
C:\wamp\bin\php\php5.2.9-1\pear is in your include_path.
Current include path : .;C:\php5\pear
Configured directory : C:\wamp\bin\php\php5.2.9-1\pear
Currently used php.ini (guess) : C:\wamp\bin\apache\apache2.2.11\bin\php.ini
Press Enter to continue:
The 'pear' command is now at your service at c:\wamp\bin\php\php5.2.9-1\pear.bat
** The 'pear' command is not currently in your PATH, so you need to
** use 'c:\wamp\bin\php\php5.2.9-1\pear.bat' until you have added
** 'C:\wamp\bin\php\php5.2.9-1' 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!
= = = = = = = = End Of Display = = = = = = = = = = =
Edit this php.ini:
c:\wamp\bin\apache\apache2.2.11\bin\php.ini
Find the following lines (fresh from a new install):
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
Uncomment the second line (remove the semicolon) and change it to:
include_path = ".;c:\wamp\bin\php\php5.2.9-1\PEAR"
Restart Apache.
You should now be able to list the available PEAR packages:
cd c:\wamp\bin\php\php5.2.9-1
pear list
If you do not have any installed PEAR packages, you will see the message:
(no packages installed from channel pear.php.net)
You can now install for example the PEAR::mail package:
pear install --alldeps mail |