Php - PEAR (PHP Extension and Application Repository) - Package Manager

Card Puncher Data Processing

About

PEAR is a framework and distribution system for reusable PHP components. See Php - Archive (phar) - Package

The PEAR package manager can:

  • install packages
  • create new packages,
  • manage a registry of installed packages,
  • check dependencies
  • interact with services on pear.php.net, and other PEAR compatible channel servers to get information about available packages.

Configuration

Installation

PEAR is normally installed with a newly php installation, check:

  • the file pear.bat under the php home
  • the directory php_dir.

If not, See installation. Example on Windows with Powershell in Admin mode:

wget http://pear.php.net/go-pear.phar -OutFile go-pear.phar
.\php.exe .\go-pear.phar
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] :

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 base ($prefix)                   : C:\php-7.2.6-Win32-VC15-x64
 2. Temporary directory for processing            : C:\php-7.2.6-Win32-VC15-x64\tmp
 3. Temporary directory for downloads             : C:\php-7.2.6-Win32-VC15-x64\tmp
 4. Binaries directory                            : C:\php-7.2.6-Win32-VC15-x64
 5. PHP code directory ($php_dir)                 : C:\php-7.2.6-Win32-VC15-x64\pear
 6. Documentation directory                       : C:\php-7.2.6-Win32-VC15-x64\docs
 7. Data directory                                : C:\php-7.2.6-Win32-VC15-x64\data
 8. User-modifiable configuration files directory : C:\php-7.2.6-Win32-VC15-x64\cfg
 9. Public Web Files directory                    : C:\php-7.2.6-Win32-VC15-x64\www
10. System manual pages directory                 : C:\php-7.2.6-Win32-VC15-x64\man
11. Tests directory                               : C:\php-7.2.6-Win32-VC15-x64\tests
12. Name of configuration file                    : C:\WINDOWS\pear.ini
13. Path to CLI php.exe                           : C:\php-7.2.6-Win32-VC15-x64

1-13, 'all' or Enter to continue:

Beginning install...
Configuration written to C:\WINDOWS\pear.ini...
Initialized registry...
Preparing to install...
installing phar://C:/php-7.2.6-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.4.3.tar...
installing phar://C:/php-7.2.6-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.4.1.tar...
installing phar://C:/php-7.2.6-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.10.5.tar...
installing phar://C:/php-7.2.6-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.1.1.tar...
installing phar://C:/php-7.2.6-Win32-VC15-x64/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.4.2.tar...
install ok: channel://pear.php.net/Archive_Tar-1.4.3
install ok: channel://pear.php.net/Console_Getopt-1.4.1
install ok: channel://pear.php.net/Structures_Graph-1.1.1
install ok: channel://pear.php.net/XML_Util-1.4.2
install ok: channel://pear.php.net/PEAR-1.10.5
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:
<C:\php-7.2.6-Win32-VC15-x64\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.

Current include path           : .;C:\php\pear
Configured directory           : C:\php-7.2.6-Win32-VC15-x64\pear
Currently used php.ini (guess) :
Press Enter to continue:

** WARNING! Old version found at C:\php-7.2.6-Win32-VC15-x64, please remove it or be sure to use the new c:\php-7.2.6-win32-vc15-x64\pear.bat command

The 'pear' command is now at your service at c:\php-7.2.6-win32-vc15-x64\pear.bat

** The 'pear' command is not currently in your PATH, so you need to
** use 'c:\php-7.2.6-win32-vc15-x64\pear.bat' until you have added
** 'C:\php-7.2.6-Win32-VC15-x64' 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!



* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\php-7.2.6-Win32-VC15-x64PEAR_ENV.reg .
This file creates ENV variables for the current user.

Double-click this file to add it to the current user registry.

Windows

Give to the users group full permission on pear.ini

Pear Ini Windows Permissions

Environment

php_dir

pear config-get php_dir
D:\xampp\php\pear

include path

The require_once() function need the php_dir to be a part of PHP's include path.

Verification:

php -c path\to\php.ini -r "echo get_include_path();"
D:\xampp\php\pear

Check: System.php is shipped with every PEAR installation and must be discoverable:

  • create the below file check_pear.php
<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>
  • Run it and verify that its outputs bool(true)
php check_pear.php
D:\tmp\check_pear.php:3:
bool(true)

Idea

Idea configuration for Pear.

Php Pear Idea

Management

Example with phpunit

pear search phpunit
Retrieving data...0%
.MATCHED PACKAGES, CHANNEL PEAR.PHP.NET:
=======================================
PACKAGE  STABLE/(LATEST) LOCAL
PHPUnit  1.3.2 (stable)        Regression testing framework for unit tests.
PHPUnit2 2.3.6 (stable)        Regression testing framework for unit tests.

install a package

  • Online
# Install the last version of the package (packageName) without the dependency.
pear install packageName

# A specifc version
pear install packageName-X.Y.Z

#  Automatically install necessary dependencies only
pear install --onlyreqdeps packageName

#  Automatically install necessary and optional dependencies 
pear install --alldeps packageName

# Force
pear install -f packageName
  • Offline
pear download Foo
# You got a file like packageName-X.Y.Z.tgz 
pear install packageName-X.Y.Z.tgz 

upgrade a package

# To the last version
pear upgrade packageName

# To a specific version
pear upgrade packageName-1.2.3

# Force
pear upgrade packageName





Discover More
Phpinfo Mbstring Enabled
Dokuwiki - Dev environment Configuration and Installation

This is the installation and configuration of the dokuwiki development platform on Windows that we use. slow. Docker with the last WSL2 is really, really slow if you don't work in WSLkeep it simpleVisual...
Idea Php Include Path
Php - PhpUnit

Unit test Framwork Get the phar file for your php version. See Requirement Powershell bash Load from include_path. You need to set it for Idea....



Share this page:
Follow us:
Task Runner