Install PEAR in a Windows 2000 environment

xiaoxiao2021-04-03  230

First, what is PEAR

PEAR is an abbreviation for PHP Extension and Application Repository (PHP extension and application library). PEAR provides a basic class library for PHP users, simplifies our workload by calling the PHP program. For a very simple example, for example, I want to set the data in the database through the WEB page, and extract the corresponding data to the Excel form. To complete this task, it is not easy to do before, but now there is a pear, and we can implement the write operation of Excel in a short time by calling the Spreadsheet class inside the pear. Long-term short say, or start our PEAR installation trip.

Second, install PEAR

First introduce my system environment:

WINDOWS 2000

WAMP1.4.3 (Apache 1.3.33 PHP 5.0.3 mysql 4.1.8)

Everyone may be more unfamiliar with Wamp, I will introduce: well known, to install these three software in the Windows environment, still need to be impressed. And Wamp (Windows Apache MySQL PHP) can help us do not need any configuration, as long as it go to its official website

Http://www.wampser.com/en/download.php Download a file called wamp5_1.4.3.exe, then run the installation directly, you can build a set of Apache / MySQL / PHP / It's not easy to use the environment.

Ok, after the system is configured, let's install the pear next step. Starting from PHP 4.04, Pear is distributed together with the PHP core. Enter the PHP installation directory, double-click Go-pear.bat, pop up a command prompt window, display the following information:

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 downline and install the pear packages bundled

With php: db, net_socket, net_smtp, mail, xml_parser, phpUnit.

IF you wish to Abort, Press Control-C Now, or Press Enter to Continue:

Here is a few basic class libraries that the system will download and install and include PEAR, including DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUnit.

Direct Enter the next step. After pressing the Enter key, the following information is displayed:

HTTP proxy (http:// user: password@proxy.myhost.com: port), or enter for none ::

Set the HTTP proxy server, if your IP address is the public address, you don't need to set it.

Enter directly. After pressing the Enter key, the following information is displayed:

Below is a suggester file layout for your new pear installation. To

Change Individual Locations, Type The Number in Front of The Number in Front of To

Directory. Type 'all' to change all of the or simply press Enter toaccept these location

1. Installation Prefix: D: / Software / Wamp / PHP

2. BINARIES DIRECTORY: $ Prefix

3. PHP Code Directory ($ PHP_DIR): $ prefix / pear

4. Documentation Base Directory: $ PHP_DIR / DOCS

5. Data Base Directory: $ PHP_DIR / DATA

6. Tests Base Directory: $ PHP_DIR / TESTS

7. PHP.EXE PATH: D: /SOFTWARE/WAMP/PHP/Php.exe

1-7, 'All' or Enter to Continue:

Set up the system environment related to PHP, if you use the PHP installed by Wamp, then

It will be directly carried here. After pressing the Enter key, the following information is displayed:

The Following Pear Packages Are Bundled with php: DB, Net_Socket, Net_SMTP,

Mail, XML_PARSER, PHPUNIT.

Would you like to install these as well? [Y / N]:

Meaning Whether to download and install DB, Net_Socket, Net_SMTP, Mail, XML_Parser, PHPUNIT these class libraries, of course,

enter

Y

Then use it to enter. After pressing the Enter key, the following information is displayed:

Loading Zlib: OK

USING LOCAL PACKAGE: PEAR ........... OK

USING LOCAL PACKAGE: Archive_Tar ...... OK

USING LOCAL PACKAGE: Console_Getopt .... OK

Using local package: XML_RPC ........ OK

Bootstrapping: pear ................... (local) OK

Bootstrapping: Archive_Tar .......... (local) OK

Bootstrapping: console_getopt ......... (local) OK

Downloading Package: DB ............. OK

Downloading package: net_socket ....... ok

Downloading package: net_smtp ......... ok

Downloading package: mail ........... OK

Downloading package: XML_Parser ....... ok

Downloading package: phpUnit ........ ok

Extracing installer ................ ok

Install OK: Pear 1.3.1

Install OK: Archive_Tar 1.2

Install OK: Console_Getopt 1.2

Install OK: XML_RPC 1.1.0

Install OK: DB 1.6.8

Install OK: Net_Socket 1.0.5

Install OK: NET_SMTP 1.2.6

Install ok: Mail 1.1.4

Install OK: XML_Parser 1.2.4

INSTALL OK: PHPUNIT 1.2.0 ************************************************************* ***********************

Warning! The incrude_path defined in the currently used php.ini does not

Contain The Pear PHP Directory You Just Specified:

If The specified directory is also not in the include_path buy by inclu

Your Scripts, You Will Have Problems Getting Any Pear Packages Working.

Current Include path:.; C: / php5 / pear

Configured Directory: D: / Software / Wamp / PHP / PEAR

Currently Used PHP.INI (GUESS):

Press Enter to Continue:

Download installation is complete (Note: To ensure your computer is connected to the Internet so that the PEAR downloads the required class library),

Enter again. display:

The 'pear' Command is now at Your Service at d: /software/wamp/php/pear.bat

** The 'pear' Command Is Not Currently in Your Path, So you need to

** USE 'D: /SOFTWARE/WAMP/PHP/Pear.bat' Until you have added

** 'D: / Software / Wamp / PHP' 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://cvs.php.net/co.php/pearweb/doc/pear_package_manager.txt?p=1

http://pear.php.net/manual/

Thanks for Using Go-Pear!

* Windows Environment Variables *

For Convenience, A Reg File Is Available Under D: /software/wamp/php/pear_env.reg

.

This File Creates Env Variables for The Current User.

Double-Click this File to add it to the capital user registry.

Press any key to continue.

After any key, the command prompt window is turned off. Finally, enter the Apache installation directory, open php.ini,

turn up:

;;;;;;;;;;;;;;;;;;;;;;;;;

Paths and Directories;

;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/ Path1: / Path2"

Include_path = ".: / php / incdude";

Windows: "/ Path1; / Path2"

Include_path = "; C: / PHP / Includes"

Change the last line to:

INCLUDE_PATH = ".; D: / Software / Wamp / PHP / PEAR"

Then save the exit.

Note: D: / Software / Wamp / PHP / PEAR

This directory is based on PHP / PEAR

The actual installation directory is filled out.

Ok, I have been installed here, is it very simple, basically run Go-pear.bat, it is possible to enter the bus along the way.

Third, install and use PEAR

Spreadsheet_excel_writer

Recrete EXCEL

form

Friends who have not used Pear may not know very well on PEAR, here we will give a simple example to explain. First enter the installation directory of PHP. Perform the following command:

Pear Download OLE

Pear Download Spreadsheet_excel_writer

Description: Pear Download Package represents Download related package.

Pear Install OLE-0.5.tgz

Pear install spreadsheet_excel_writer-0.8.tgz

Description: Pear Install PackageName represents the installation related packagename. More commands on PEAR and meaning can be viewed. After installation, execute the Pear List, if you see the following 2 line, you will explain the installation.

OLE 0.5 beta

Spreadsheet_excel_writer 0.8 Beta

Then we build a Test.php file in the WWW directory, the content is as follows:

INCLUDE_ONCE "Spreadsheet / Excel / Writer.php";

$ xls = & new spreadsheet_excel_writer ();

$ XLS-> Send ("Test.xls");

$ Sheet = & $ XLS-> Addworksheet ('Test Results');

$ Sheet-> Write (0,0,12);

$ Sheet-> Write (0, 1, "Hallo, Ich Bin Ein Text");

$ FORMAT = & $ XLS-> addformat ();

$ FORMAT-> setBold ();

$ FORMAT-> SetColor ("Green");

$ Sheet-> Write (1, 1, "Hallo, Ich Bin Formatiert", $ FORMAT);

$ xls-> close ();

?>

Then run directly. At this point IE browser pops up a dialog box for downloading the Test.xls file. After downloading, you can see the generated Excel table file. Specific spreadsheet_excel_writer generates the Excel form format syntax, you can refer to the official manual of PEAR, here is not said. Ok, our Pear tour is over here. Have you started interested in PEAR, then you can't try it!

转载请注明原文地址:https://www.9cbs.com/read-131673.html

New Post(0)