PHP - PEAR Auto Install
The PHP Extension and Application Repository (or PEAR for short) contains re-usable code. This page covers PEAR installation using go-pear, which is integrated into The Uniform Server’s architecture.
Note: Due to a change in the repository structure, the procedures outlined below for installation now fail completely. According to the site, it’s unlikely that go-pear will be updated or maintained! Because of this the PEAR core has been preinstalled.
You can skip the entire Install PEAR core package section.
Install PEAR core package
Open Pear control panel as follows:
Server Configuration > PHP > Pear Control Panel
- Click Install Pear button (1)
- PEAR intaller opens in your browser. There is nothing to do other than to click OK at each prompt as follows:
- Welcome to go-pear - Click Next >>
- At the end of Configuration section - Click Install
- Installation process starts; this will take a while to complete.
|
|
- Expected results are shown on right.
Note: Your Installation path may be different!
|
Starting installation ...
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.............ok
Installing bootstrap package: Structures_Graph.......ok
Downloading and installing package: Archive_Tar-stable.......ok
Downloading and installing package: Console_Getopt-stable.......ok
Downloading and installing package: PEAR_Frontend_Web-beta.......ok
Writing WebFrontend file ... ok
Installation Completed !
Note: To use PEAR without any problems you need to add your
PEAR Installation path (C:\UniServer\home\us_pear\PEAR)
to your include_path.
Using a .htaccess file or directly edit httpd.conf would be working
solutions for Apache running servers, too.
Note: Above path already pre-configured in The Uniform Server hence
you are ready to go.
For more information about PEAR, see:
PEAR FAQ
PEAR Manual
Thanks for using go-pear!
Start Web Frontend of the PEAR Installer >>
|
- Scroll to end of installation section.
- Click the link Start Web Frontend of the PEAR Installer
- Web Front End opens in your default browser as shown on right.
|
|
Open PEAR Web Frontend
After installing PEAR, you can access the web-front-end at any time using either of the following methods:
Method 1 Run the web-front-end from UniController menu as follows;
Server Configuration > PHP > Pear Control Panel
Click View Pear Front-end button
|
|
Method 2 Alternatively enter the following into your browser:
http://localhost/us_pear/index.php
|
Using PEAR Frontend
Open the PEAR front-end using one of the methods explaind above.
Installing PEAR packages is very easy. To confirm our PEAR installation is working and to demonstrate how to install packages, we will be using a package named HTML_QuickForm
Update the Channel Management system
Before downloading any package, update the Channel Management system
- C) Click on Channel Management - Opens Registered Channels page.
- From this page, click on Update All Channels
You will receive something similar this:
Updating channel "doc.php.net"
Update of Channel "doc.php.net" succeeded
Updating channel "pear.php.net"
Channel "pear.php.net" is up to date
Updating channel "pecl.php.net"
Channel "pecl.php.net" is up to date
|
|
Downloading modules
Downloading a known package (example HTML_QuickForm)
- A) Click on Package Management - Opens management page.
- Scroll down page to Quick-install a package
- Enter package name HTML_QuickForm
- Click Install
|
|
- After a short time the package is installed.
- Note the Warnings! We know this is an older package but want to use it anyway.
|
|
- A) Click on Package Management - Opens management page.
- New Installed packages are listed.
Although we intended to only download and install a single package, two were installed. The package HTML_QuickForm will not function without package HTML_Common; it depends on this being in place. In other words, when installing a package, all dependencies that do not exist are also installed.
|
|
Form - Test Script
Create a new text file named form.php with the following content and save to folder UniServer\www
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Pear HTML_QuickForm test</title>
</head>
<body>
<?php
require_once "HTML/QuickForm.php";
$form = new HTML_QuickForm('frmTest', 'get');
$form->addElement('header', 'MyHeader', 'Testing QuickForm');
$form->addElement('text', 'MyTextBox', 'What is your name?');
$form->addElement('reset', 'btnClear', 'Clear');
$form->addElement('submit', 'btnSubmit', 'Submit');
$form->display();
?>
</body>
</html>
Test:
- Start The Uniform Server
- Type the following into a browser: http://localhost/form.php
- Expected result is shown on right.
|
|
Where to next
PHP - PEAR Manual Install - This page covers manual PEAR installation.
|