How to Install PEAR on WAMP for Symfony
Although a PEAR subdirectory is created during WAMP installation, PEAR is not included with the Wampserver. To install PEAR open a command prompt window (Start->Run->cmd. Then Enter). Go to the php executables subdirectory and run php -d phar.require_hash=0 PEAR/go-pear.phar:
C:\wamp\bin\php\php5.3.0>php -d phar.require_hash=0 PEAR/go-pear.phar
Reply to “Are you installing a system-wide PEAR or a local copy?” with “local”. When prompted, set each directory to the following scheme (note: the php version may differ):
| 1. Installation base ($prefix) | : C:\wamp\bin\php\php5.3.0 |
| 2. Temporary directory for processing | : C:\wamp\bin\php\php5.3.0\tmp |
| 3. Temporary directory for downloads | : C:\wamp\bin\php\php5.3.0\tmp |
| 4. Binaries directory | : C:\wamp\bin\php\php5.3.0 |
| 5. PHP code directory ($php_dir) | : C:\wamp\bin\php\php5.3.0\pear |
| 6. Documentation directory | : C:\wamp\bin\php\php5.3.0\pear\docs |
| 7. Data directory | : C:\wamp\bin\php\php5.3.0\pear\data |
| 8. User-modifiable configuration files directory | : C:\wamp\bin\php\php5.3.0\pear\cfg |
| 9. Public Web Files directory | : C:\wamp\www |
| 10. Tests directory | : C:\wamp\bin\php\php5.3.0\pear\tests |
| 11. Name of configuration file | : C:\wamp\bin\php\php5.3.0\pear.ini |
| 12. Path to CLI php.exe | : C:\wamp\bin\php\php5.3.0\. |
Although the installation will attempt to change php.ini (it will prompt you first) so that include_path points to PEAR, it uses c:\wamp\bin\php\php5.3.0\php.ini rather than C:\wamp\bin\apache\apache2.2.11\bin\php.ini. So after php -d phar.require_hash=0 go-pear.phar concludes be sure C:\wamp\bin\apache\apache2.2.11\bin\php.ini has this line (your version numbers may differ).
include_path=".;c:\wamp\bin\php\php5.3.0\pear"
You may also need to check that include_path in “c:\wamp\bin\php\php5.3.0\php.ini” also has include_path=".;c:\wamp\bin\php\php5.3.0\pear", as I believe the command line version of php.exe may use this php.ini. It won’t hurt.
Restart Apache to reload the new php.ini and run phpinfo to verify the include_path.
Change the Windows PATH environment variable to include c:\wamp\bin\php\php5.3.0 (in Windows Vista: Start->Control Panel->System and Maintenance->System->Advanced System Settings->Environment Variable. Edit the PATH system variable and add c:\wamp\bin\php\php5.3.0). Now start a Windows command prompt and type pear. It will list all the pear commands. pear list will list all PEAR packages current installed. Use pear install -o <package> to install a package ( -o will install required dependencies).
You may need to add the following environment variables to the environment.
PHP_PEAR_BIN_DIR=C:\wamp\bin\php\php5.3.0 PHP_PEAR_DATA_DIR=C:\wamp\bin\php\php5.3.0\PEAR\data PHP_PEAR_DOC_DIR=C:\wamp\bin\php\php5.3.0\PEAR\docs PHP_PEAR_INSTALL_DIR=C:\wamp\bin\php\php5.3.0\pear PHP_PEAR_PHP_BIN=C:\wamp\bin\php\php5.3.0\php.exe PHP_PEAR_SYSCONF_DIR=C:\wamp\bin\php\php5.3.0 PHP_PEAR_TEST_DIR=C:\wamp\bin\php\php5.3.0\PEAR\tests
Go to a command line prompt and type SET, to check the settings for the enviroment variables above.
A brief overview of the pear command line tool commands:
- pear — This list all the PEAR commands.
- pear help — This will tell you what the command does.
- pear config-show — This shows your pear configuration.
- pear list — This will show you the PEAR packages currently installed.
- pear list -a — This will show you the PEAR packages currently installed in all channels.
- pear channel-discover — This will initialize a new channel, so you can install packages from it
- pear search — This will search for a PEAR package.
- pear uninstall — This will uninstall a PEAR package.
- pear uninstall — This will uninstall a PEAR package.
- pear upgrade — This will upgrade all packages currently installed.
- pear upgrade — This will upgrade all packages currently installed.
This example shows how to install the Doctrine 2 ORM using the pear command line tool:
pear channel-discover pear.doctrine-project.org pear install pear.doctrine-project.org/DoctrineORM
After a package is installed, the documentation for the package will be in a newly created folder under C:\wamp\bin\php\php5.3.0\PEAR\docs\.
The C:\wamp\bin\php\php5.3.0\PEAR\test\ folder typically contains a sample test php script, to test the package.
Some packages are in beta. To install them you first need to set the preferred release to beta:
pear config-set preferred_state beta. Then after installing the beta package do pear config-set preferred_state stable.
PEAR_Frontend_Web package, which was in Beta when this was written, is a web-based front-end alternative to the command line PEAR package manager. To install it open a Windows command prompt and do:
c:\wamp\bin\php\php5.3.0>pear install PEAR_Frontend_Web








Blog Detail
