Home > Article > Backend Development > PEAR tutorial (1)--Pear introduction and installation_PHP tutorial
First of all, please open this link http://pear.php.net/manual/en/ Let’s take a look at what PEAR is and click on Chapter 1. Introduction. PEAR is short for “PHP Extension and Application Repository” andis pronounced just like the fruit. The purpose of PEAR is toprovide:Pear is the abbreviation of “PHP Extension and Application Repository” and is pronounced like the English word “pear”, so you The logo of this website is a pear. * A structured library of open-source code for PHP users An open source code library that can be used by all PHP developers Reader requirements: 1. Be able to build a WAMP (window+apache+mysql+php) server. 2. Know simple php3. Willing to use PEAR The following introduces the installation of PEAR (this is very important): First of all, let’s talk about the path problem of php’s include. This is similar to java’s classpath. There is a default path. For example, php.ini sets several default paths /etc/include or /etc/DEMO, then in In the PHP code, if there is an include statement similar to "include'file.php';", when the program is executed, it will search for the file file.php in the current folder. If not, it will search /etc/ Is there such a file in the include or /etc/DEMO folder? If it is still not there, an error will be reported! For foreign virtual hosts, many have PEAR installed, and the installed PEAR packages are all complete, so if you quote include "PEAR.php" in the php file, the program will find the path to PEAR based on php.ini And the reference comes in, but if the virtual host does not have PEAR installed, we have to install it ourselves. Installing PEAR is a very simple process, so don’t be afraid. The following will guide you to the help manual. The link is here (because many people are unclear about the file structure of PEAR, this manual has been deleted), but It doesn’t matter, you can go to this link to have a look. Maybe few people have the patience to read it, but I can’t stand it anyway. In fact, the most critical line is this line, which tells you how to add the default include path of php Okay, let’s start with the installation steps: First, suggest the folder "tutor" in the root directory of the website, then create a folder inc, and download PEAR. The current download address of the latest version is http://download.pear.php.net/package/PEAR- 1.6.1.tgz.
* A system for code distribution and package maintenance is a packaging system for code distribution
* A standard style for code written in PHP, specifiedhere is a standard for php code format
* The PHP Extension Community Library (PECL), see morebelow is a PECL library
…
In a word, PEAR is a A powerful php library, which I also use for my bloggermap, and the package of this library is very complete, including database, form generation, and caching. I will introduce it to you step by step later.
After downloading and decompressing, place PEAR in the inc directory. The expanded directory is as shown in the figure:;
includedefine,].define,WEB_DIR.//Path of the PEAR directory
, PEAR_DIR .PATH_SEPARATOR .?> ;
Open http://127.0.0.1/tutor/demo.php again, what do you find? The error is gone!
At this point, PEAR installation is completed