Okay, I must admit: I'm a programmer and I know some commands. Because I want to use PEAR packages, I needed to install it. The installing command is quite easy to find, but I had a hard time determining the directory structure. Some searching on the internet and an IRC conversation (EFNet #pear, thanks davidc_!) later I was able to install PEAR in a quite reasonable directory structure.
Now that all is done it sounds logical. This blogpost is meant for people who want to install PEAR, but are not sure how to do it or about the directories which need to be specified.
Starting install
Log on to your server on the command line (as root). The install acan then be started as follows:
lynx -source http://pear.php.net/go-pear | php
Directories
After some questions (which in 99% of the cases just get the default answer), you'll get the prompt for the directories. After adjustment, my structure looks as follows:
1. Installation prefix ($prefix) : /usr 2. Temporary files directory : $prefix/temp 3. Binaries directory : $prefix/bin 4. PHP code directory ($php_dir) : $prefix/share/PEAR 5. Documentation base directory : $php_dir/docs 6. Data base directory : $php_dir/data 7. Tests base directory : $php_dir/tests
Finishing installation
When the installation is done, the config (php.ini) file can automatically be adjusted. Note that you have to restart apache to load this new config.
The full overview
A complete overview from my PEAR install in- and output is given below.
[root@server usr]# lynx -source http://pear.php.net/go-pear | php Welcome to go-pear! Go-pear will install the 'pear' command and all the files needed by it. This command is your tool for PEAR installation and maintenance. Go-pear also lets you download and install the following optional PEAR packages: PEAR_Frontend_Web-beta, PEAR_Frontend_Gtk2, MDB2. If you wish to abort, press Control-C now, or press Enter to continue: HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none:: 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 prefix ($prefix) : /usr 2. Temporary files directory : $prefix/temp 3. Binaries directory : $prefix/bin 4. PHP code directory ($php_dir) : $prefix/PEAR 5. Documentation base directory : $php_dir/docs 6. Data base directory : $php_dir/data 7. Tests base directory : $php_dir/tests 1-7, 'all' or Enter to continue: 4 PHP code directory ($php_dir) [$prefix/PEAR] : $prefix/share/PEAR 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 prefix ($prefix) : /usr 2. Temporary files directory : $prefix/temp 3. Binaries directory : $prefix/bin 4. PHP code directory ($php_dir) : $prefix/share/PEAR 5. Documentation base directory : $php_dir/docs 6. Data base directory : $php_dir/data 7. Tests base directory : $php_dir/tests 1-7, 'all' or Enter to continue: PHP Warning: putenv(): Safe Mode warning: Cannot set environment variable 'TMPDIR' - it's not in the allowed list in /usr/- on line 1264 The following PEAR packages are bundled with PHP: PEAR_Frontend_Web-beta, PEAR_Frontend_Gtk2, MDB2. Would you like to install these as well? [Y/n] : n Loading zlib: ok Bootstrapping Installer................... Bootstrapping PEAR.php............(remote) ok Bootstrapping Archive/Tar.php............(remote) ok Bootstrapping Console/Getopt.php............(remote) ok Extracting installer.................. Downloading package: PEAR.............ok Downloading package: Structures_Graph....ok Preparing installer.................. Updating channel "doc.php.net" Update of Channel "doc.php.net" succeeded Updating channel "pear.php.net" Update of Channel "pear.php.net" succeeded Updating channel "pecl.php.net" Update of Channel "pecl.php.net" succeeded Installing selected packages.................. Downloading and installing package: PEAR.............warning: pear/PEAR requires package "pear/Archive_Tar" (recommended version 1.3.3) warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.2) warning: pear/PEAR requires package "pear/Console_Getopt" (recommended version 1.2.3) warning: pear/PEAR requires package "pear/XML_Util" (recommended version 1.2.1) downloading PEAR-1.9.0.tgz ... Starting to download PEAR-1.9.0.tgz (291,634 bytes) .............................................................done: 291,634 bytes install ok: channel://pear.php.net/PEAR-1.9.0 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" Installing bootstrap package: Structures_Graph.......install ok: channel://pear.php.net/Structures_Graph-1.0.3 Downloading and installing package: Archive_Tar-stable.......downloading Archive_Tar-1.3.5.tgz ... Starting to download Archive_Tar-1.3.5.tgz (17,184 bytes) ...done: 17,184 bytes install ok: channel://pear.php.net/Archive_Tar-1.3.5 Downloading and installing package: Console_Getopt-stable.......downloading Console_Getopt-1.2.3.tgz ... Starting to download Console_Getopt-1.2.3.tgz (4,011 bytes) ...done: 4,011 bytes install ok: channel://pear.php.net/Console_Getopt-1.2.3 ****************************************************************************** WARNING! The include_path defined in the currently used php.ini does not contain the PEAR PHP directory you just specified: </usr/share/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 </etc/php.ini>? [Y/n] : Y php.ini </etc/php.ini> include_path updated. Current include path : .: Configured directory : /usr/share/PEAR Currently used php.ini (guess) : /etc/php.ini Press Enter to continue: The 'pear' command is now at your service at /usr/bin/pear [root@server usr]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]