# Getting and installing the PEAR package manager

## Windows

After you have downloaded and installed PHP, you have to manually execute the batch file located in e.g. c:\php\go-pear.bat. Alternatively, download http://pear.php.net/go-pear.phar with your browser and save the output to a local file named go-pear.phar. You can then run

      
php go-pear.phar



in a Windows Command Prompt to start the installation.

The setup will ask you some questions and afterwards the PEAR Package Manager will be installed in the path, which you have specified during installation.

Finally you have to add that installation path to your PATH environment. Either do this manually (Start > Control Panel > System > Environment) or run (double-click) the newly generated PEAR_ENV.reg that's now found in the PHP source directory.

After that you can access the PEAR Package Manager by running the command pear in a Windows Command Prompt.

After changing php.ini, you will need to restart your web server.

## Unix/Linux/BSD

When using PHP, the PEAR Package Manager is already installed unless one has used the ./configure option --without-pear.

If one uses a version of PHP that is supplied by Unix/Linux/BSD distributors it may be necessary to manually install PEAR. Users should consult the documentation for the respective distribution in this case.

If you want to re-install the Package Manager, you can use the following provisional way:

      
$wget http://pear.php.net/go-pear.phar$ php go-pear.phar



Please note, you may need to install the wget package via your Unix/Linux/BSD package manager. On Debian and Ubuntu this is done via:

      
$sudo apt-get install wget   Alternatively, download the go-pear.phar file via your browser. If the process just exits without any output, your syslog will probably contain the following lines: suhosin[4705]: ALERT - Include filename ('phar://go-pear.phar/index.php') is an URL that is not allowed (attacker 'REMOTE_ADDR not set', file '/root/go-pear.phar', line 1236)  To work around this problem, enable the phar in /etc/php5/conf.d/suhosin.ini: suhosin.executor.include.whitelist = phar  ## Mac OS X On Mac OS 10.4 and earlier, the PEAR Package Manager is already installed in /usr/bin/pear. If you are using Mac OS 10.5 (Leopard), would like to install a new copy, or re-install the PEAR Package Manager use the following command:  $ wget http://pear.php.net/go-pear.phar
$php -d detect_unicode=0 go-pear.phar   Please note, you may need to install the wget package prior to running these commands. Alternatively, use curl as shown below or download the go-pear.phar file via your browser.  $ curl -O http://pear.php.net/go-pear.phar
$php -d detect_unicode=0 go-pear.phar   For a system-wide installation, you will need to execute the go-pear script with increased permissions. This is only recommended for advanced users.  $ wget http://pear.php.net/go-pear.phar
$sudo php -d detect_unicode=0 go-pear.phar   ## PEAR in hosting environments If you are running your site at a web hosting provider with no direct access to the server (via local logins, Telnet or SSH), you can use the PEAR Installer using the Web Frontend or (S)FTP. Go to go-pear and save as go-pear.php. Copy go-pear.php to your server and open the corresponding URL in your browser, for example http://example.com/pear/go-pear.php. Do not forget to protect the pear directory if you did not do already before the installation: Make it unreadable and not executable from external (i.e. put it outside public_html). Introduction (Previous) Installation of a local PEAR copy on a shared host (Next) Last updated: Sun, 21 Dec 2014 — Download Documentation Do you think that something on this page is wrong? Please file a bug report or add a note. View this page in: ### User Notes: Note by: user@example.com This is how I installed PEAR on Mac OS X Mavericks : http://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/ Note by: techno_aesthete I just installed PHP 5.5.5 (VC11 x86 non thread safe) on Windows Server 2008. Before installing, I did the checksum and it matched. There is no go-pear.bat file in the PHP directory. Note by: geza@turigeza.com On windows vista/7, logging in as an administrator is not enough, right-click on the bat file and click "Run as administrator" Fails on windows 7 Could not open input file: PEAR\go-pear.phar Press any key to continue . . . Note by: schwarzenneger@hotmail.com windows users might an error similar to "unable to write to c:\windows\pear.ini" when they try to execute the go-pear.bat file. The workaround is to run the file as an administrator: - Login as an administrator and run the bat file - On windows vista/7, logging in as an administrator is not enough, right-click on the bat file and click "Run as administrator" - Alternate methid: on windows xp/vista/7, open a command prompt as an administrator and run the command "C:\path\to\go-pear.bat" Note by: ore ore It's not work. Installer say as follows. Bootstrapping PEAR.php............(remote) "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> An Exception Has Occurred Unknown location: /pear/pear-core/branches/PEAR_1_4/PEAR.php HTTP Response Status 404 Not Found Is it need change "svn.php.net" to "github.com" ? Note by: user@example.com Thanks for the wonderful information. I wanted to install PEAR/PECL using yum and was stuck. This information can be found here <a href="http://programmingbulls.com/pecl-install"> PECL PEAR Install on Ubuntu</a> Note by: drrm I just spent about an hour trying to get PHPUnit on my windows machine via pear and thought I'd share some tips. 1) I tried to update to the most recent PEAR installer using the version from the website. This did not succeed. Instead I did pear upgrade PEAR 2) The PEAR installer appears to choke with a space in the temp directory name. By default the pear install chose a directory off of my PHP install which is in "program files" and I foolishly accepted the default. By changing the temp dir with pear config-set temp_dir c:\temp My install worked. david Note by: user@example.com Ran into an error updating PEAR today, June 15 2011. I did a fresh reformat, so this is everything I did: 1) Installed latest XAMPP for windows (zipped), XAMPP 1.7.4 2) Downloaded latest go-pear.phar from pear.php.net/go-pear.phar 3) Put go-pear.phar into xampp\php\ directory 4) Ran command "php go-pear.phar" This results in errors, which can be viewed here: http://pastebin.com/fiq6riX2 (System.php, line 302, mkdir() errors.) Luckily, I had an old go-pear.phar version from May 3, 2011. That one installed/updated properly. Note by: user@example.com I got it to work... -.-" sigh.... Is there a way to suggest to try install php5-cli in order to install pear? Otherwise for a linux newb it makes him want to cry. (or die{}) Note by: zourtney@gmail.com If wget is not available from the terminal, use curl to download the PHP file. For example: curl http://pear.php.net/go-pear.phar > go-pear.php Note by: cweiske Instead of using the outdated http://pear.php.net/go-pear , use http://pear.php.net/go-pear.phar It cannot be piped into php but must be saved first and then executed with php:$ wget http://pear.php.net/go-pear.phar && php go-pear.phar
Note by: mcconnell210@hotmail.com
PHP v5.3.4 threadsafe on Windows 7 64bit.

Executing go-pear.bat gives:

phar "C:\Program Files (x86)\php\PEAR\go-pear.phar" does not have a signature
PHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\Program Files (x86)\php\PEAR\go-pear.phar on line 1236.

See other notes below. I'll raise a bug.

Note by: Matt
"For all versions prior to 4.3.0 or if you want to re-install the Package Manager, you can use the following provisional way:
$lynx -source http://pear.php.net/go-pear | php " I get: lynx -source http://pear.php.net/go-pear | php X-Powered-By: PHP/4.1.2 Content-type: text/html Sorry! Your PHP version is too old. PEAR and this script requires at least PHP 4.3.0 for stable operation. Can I just comment out this line in go-pear.php: if (function_exists("version_compare") && version_compare(phpversion(), "4.3.0",'<')) {... Note by: Eric Anderson Note: If you're running PEAR as a non-root user, there's a good chance that the default configuration will want to install files to directories which are not writable for you. To see the entire configuration, run:$ pear config-show

I needed to change the following settings:
Note by: cweger@gmail.com
PEAR installation fails on Mac OS X 10.6.4 with the following message:

Cannot redeclare _PEAR_call_destructors() (previously declared in /usr/lib/php/temp/PEAR.php:765) in /usr/lib/php/temp/temp/PEAR.php on line 777
Note by: it@pesgce.com
Installing on Mac OS X Server 10.6.4 fails:

(after using curl | sudo php and accepting installer defaults):

ok
ok

Preparing installer..................
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 650
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 697
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 757
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 786
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 914
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 1577
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 1607
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 2038
PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/temp/temp/PEAR/Config.php on line 2091
PHP Fatal error: Cannot redeclare _PEAR_call_destructors() (previously declared in /usr/local/temp/PEAR.php:765) in /usr/local/temp/temp/PEAR.php on line 777

Oddly enough, Pear is installed by default on Mac OS X 10.6… just not Server.
Note by: Hecticjeff@gmail.com
In the os x section it should read os x 10.4+ not 10.4 and earlier.
Note by: YasuakiH
Error message:
> phar "/<path>/go-pear.phar" does not have a signature
> PHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar "/<path>/go-pear.phar" does not have a signature in /<path>/go-pear.phar on line 1236

Try this:
php.exe -d phar.require_hash=0 go-pear.phar

Reference:
PEAR install weirdness
h ttp://lenss.nl/2008/07/pear-install-weirdness/
Note by: possien@q.com
When I run the go-pear.bat (in dos window) I get the following error:

Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-xistant phar "phar://go-pear.phar/index.php" in C:\Program Files\EasyPHP5.3.0\php\PEAR\go-pear.phar on lin1236

Any suggestions?
Note by: marcin.stefanowicz@signal-iduna.pl
I've tried to install by go-pear on Windows command line. After it downloads Structures_Graph, XLM Error occures telling me that "not well-formated (invalid token) on line 10. So installation of that, and any futher package is not possible.
Note by: hopfgartner
PEAR seems to require PHP 4.3, at least:

wget http://pear.php.net/go-pear
php go-pear

tells me:

X-Powered-By: PHP/4.2.2
Content-type: text/html

Sorry! Your PHP version is too old. PEAR and this script requires at
least PHP 4.3.0 for stable operation.

Regards,

Peter
Note by: cweiske
When you are behind a proxy, you can export the HTTP_PROXY variable. Don't forget the http:// in its value.