SITE SEARCH

Google
 

Thursday, June 26, 2008

How to install PEAR packages in Ubuntu

Open the terminal and type the following command

sudo apt-get install php-pear

Then after installing pear follow this procedure to install packages

I am installing System_Folder package

Example

sudo pear install System_Folders

output:
Did not download optional dependencies: pear/XML_Parser, pear/XML_Util, use --alldeps to download automatically
pear/Config can optionally use package "pear/XML_Parser"
pear/Config can optionally use package "pear/XML_Util"
downloading System_Folders-1.0.0.tgz ...
Starting to download System_Folders-1.0.0.tgz (8,364 bytes)
.....done: 8,364 bytes
downloading Config-1.10.11.tgz ...
Starting to download Config-1.10.11.tgz (27,718 bytes)
...done: 27,718 bytes
install ok: channel://pear.php.net/Config-1.10.11
install ok: channel://pear.php.net/System_Folders-1.0.0


Then type

pear list

to check that System_Folders is installed

Output

Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.2 stable
Config 1.10.11 stable
Console_Getopt 1.2.2 stable
PEAR 1.5.4 stable
Structures_Graph 1.0.2 stable
System_Folders 1.0.0 stable

The System_Folders appears in the list.

Also pear list-files System_Folders

will help you to find Installed Files For System_Folders

like

php /usr/share/php/System/Folders/Cached.php
doc /usr/share/php/docs/System_Folders/examples/cached.php
doc /usr/share/php/docs/System_Folders/examples/example.php
php /usr/share/php/System/Folders.php

Finally the example using System_Folders


require_once 'System/Folders.php';
$sf = new System_Folders();
$home = $sf->getHome();
echo "$home\n";

?>

No comments: