 |
|
Oracle Database Tips by Donald Burleson
|
Installing PEAR Modules
PEAR stands for "PHP Extension and Application
Repository" and is the PHP version of Perl CPAN. Several PEAR modules
have been used throughout this book, and they are very useful. The DBA
tool ("DBA_Helper", Chapter 7) also uses several PEAR modules. The
same way Perl comes with "cpan" executable, PHP comes with "pear".
In the installation, pear is in /usr/local/bin
with the rest of the PHP executables. As the PHP installation was
performed by user root, PEAR modules should also be manipulated by
root. The first step in this process is to see how pear can help by
executing "pear help":
pear help
Usage: pear [options] command [command-options] <parameters>
Type "pear help options" to list all options.
Type "pear help <command>" to get the help for the specified command.
Commands:
build Build an Extension From C Source
bundle Unpacks a Pecl Package
clear-cache Clear XML-RPC Cache
config-get Show One Setting
config-help Show Information About Setting
config-set Change Setting
config-show Show All Settings
cvsdiff Run a "cvs diff" for all files in a
package
cvstag Set CVS Release Tag
download Download Package
download-all Downloads each available package from
master_server
info Display information about a package
install Install Package
list List Installed Packages
list-all List All Packages
list-upgrades List Available Upgrades
login Connects and authenticates to remote
server
logout Logs out from the remote server
makerpm Builds an RPM spec file from a PEAR
package
package Build Package
package-dependencies Show package dependencies
package-validate Validate Package Consistency
remote-info Information About Remote Packages
remote-list List Remote Packages
run-tests Run Regression Tests
search Search remote package database
shell-test Shell Script Test
sign Sign a package distribution file
uninstall Un-install Package
upgrade Upgrade Package
upgrade-all Upgrade All Packages
PEAR comes with several preinstalled packages,
although the versions are not quite current. The versions can be seen
by using the "pear list" command like this:
pear list
Installed packages:
===================
Package Version State
Archive_Tar 1.1 stable
Console_Getopt 1.2 stable
PEAR 1.3.3 stable
XML_RPC 1.1.0 stable
To upgrade the existing packages to their current
versions use "pear upgrade-all":
pear
upgrade-all
Will upgrade archive_tar
Will upgrade pear
Will upgrade xml_rpc
downloading Archive_Tar-1.2.tar ...
Starting to download Archive_Tar-1.2.tar (-1 bytes)
....................done: 83,456 bytes
downloading PEAR-1.3.5.tar ...
Starting to download PEAR-1.3.5.tar (-1 bytes)
...done: 557,056 bytes
downloading XML_RPC-1.2.0.tar ...
Starting to download XML_RPC-1.2.0.tar (-1 bytes)
...done: 104,960 bytes
upgrade-all ok: Archive_Tar 1.2
upgrade-all ok: XML_RPC 1.2.0
upgrade-all ok: PEAR 1.3.5
It is easy to see what is available. Using "pear
list-all" readily reveals the list of available packages that can be
installed. Because this list would be very long, it is not shown here.
Instead of looking for all the packages, only those that are really
needed will be searched for; the ones that have either "HTML" or "DB"
in their name. The command to use is pear list-all|egrep "HTML|DB":
pear list-all|egrep
"HTML|DB"
DB 1.6.8
DBA 1.1
DB_ado 1.3
DB_DataObject 1.7.2
DB_ldap 1.1.0
DB_NestedSet 1.2.4
DB_odbtp 1.0.2
DB_Pager 0.7
DB_QueryTool 0.11.1
MDB 1.3.0
MDB_QueryTool 0.11.1
HTML_BBCodeParser 1.1
HTML_Common 1.2.1
HTML_Crypt 1.2.2
HTML_CSS 0.2.0
HTML_Form 1.1.2
HTML_Javascript 1.1.0
HTML_Menu 2.1.1
HTML_Progress 1.2.0
HTML_QuickForm 3.2.4pl1
HTML_QuickForm_Controller 1.0.4
HTML_Select_Common 1.1
HTML_Table 1.5
HTML_Table_Matrix 1.0.7
HTML_Template_Flexy 1.2.1
HTML_Template_IT 1.1
HTML_Template_PHPLIB 1.3.1
HTML_Template_Sigma 1.1.2
HTML_Template_Xipe 1.7.6
HTML_TreeMenu 1.1.9
XML_HTMLSax 2.1.2
In this book, DB, HTML_Form and HTML_Table were
used. In order to install HTML_Table and HTML_Form packages,
HTML_Common is also needed. These packages can now be installed by
issuing the "pear install" command with the appropriate arguments:
pear install
DB HTML_Common HTML_Table HTML_Form
downloading DB-1.6.8.tar ...
Starting to download DB-1.6.8.tar (-1 bytes)
....................................................................................................................done:
576,000 bytes
downloading HTML_Common-1.2.1.tar ...
Starting to download HTML_Common-1.2.1.tar (-1 bytes)
...done: 16,896 bytes
downloading HTML_Table-1.5.tar ...
Starting to download HTML_Table-1.5.tar (-1 bytes)
...done: 36,864 bytes
downloading HTML_Form-1.1.2.tar ...
Starting to download HTML_Form-1.1.2.tar (-1 bytes)
...............................done: 145,920 bytes
install ok: HTML_Form 1.1.2
install ok: HTML_Common 1.2.1
install ok: DB 1.6.8
install ok: HTML_Table 1.5
If the "pear list" command from the beginning of
this chapter is executed, notice that the list of the installed
package has changed, just as was desired.
pear list
Installed packages:
===================
Package Version State
Archive_Tar 1.2 stable
Console_Getopt 1.2 stable
DB 1.6.8 stable
HTML_Common 1.2.1 stable
HTML_Form 1.1.2 stable
HTML_Table 1.5 stable
PEAR 1.3.5 stable
XML_RPC 1.2.0 stable
These packages are installed in the /usr/local/lib/php
directory, and the HTML packages are installed in the /usr/local/lib/php/HTML
directory. That is why we include them by putting a command like
require_once("HTML/Form.php") into our script. The subdirectory
"HTML" is in the include path (defined by parameter described above)
and the file Form.php is in that subdirectory.
$ ls -l /usr/local/lib/php/HTML/Form.php
-rw-r--r-- 1 root root 95015 Feb 27 02:07 /usr/local/lib/php/HTML/Form.php
Unfortunately, some of the packages have very poor
documentation and the only way to learn how to use them is to read the
package source code. HTML_Form is one such package. PEAR packages are
being updated daily and are documented on
http://pear.php.net.
When the new version arrives, the existing version can be upgraded by
issuing "pear upgrade <pkg-name>".
The PEAR installer is simple and very practical.
The Linux configuration is now complete and the PEAR packages are
ready to be used. This concludes the installation on Linux. The next
few sections repeat this process on Microsoft Windows 2000. Installing
on Windows 2000 is quite a bit easier than installing on Linux.
See
code depot for complete scripts
This is an excerpt from the book
Easy Oracle PHP. You can get it
for more than 30% by buying it directly from the publisher and get
instant HTML-DB scripts from the code depot:
 |
Easy Oracle PHP
Create Dynamic Web Pages with Oracle Data
Includes online HTML-DB code depot
Buy it now for 30% off
- Only $19.95
|
HTML-DB support:
 |
For HTML-DB development support just call to gat an
Oracle Certified professional for all HTML-DB development
projects. |
|