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 see this The website's logo is a pear.
* A structured library of open-source code for PHP users A library of open-source code that all PHP developers can use
* 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 style for php code format
* The PHP Extension Community Library (PECL), see morebelow is a PECL library...
In a word, PEAR is a powerful php library. My bloggermap also uses this library, 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.
Reader requirements: 1. Be able to build a WAMP (window+apache+mysql+php) server. 2. Be familiar with simple php3. Willing to use PEAR. Let’s
introduce the installation of PEAR (this is very important):
First, let’s talk about the path of php’s include. This is similar to the classpath of java. There is a default path, such as php.ini. Several default paths /etc/include or /etc/DEMO are set, then in the PHP code, if there is an include statement similar to "include'file.php';", it will be in the current folder when the program is executed. Search to see if there is file.php. If not, search for the file in /etc/include or /etc/DEMO folder. If there is still no file, 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 quote it. , 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 can’t figure out the file structure of PEAR, this manual has been deleted), but it doesn’t matter. You can go to this link to see it. 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
<?phpini_set('include_path','~/pear/ lib'.PATH_SEPARATOR.ini_get('include_path'));// From PHP 4.3.0 onward, you can use the following,// which especially useful on shared hosts:set_include_path('~/pear/lib'.PATH_SEPARATOR.get_include_path ());?>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 for the latest version is http:// download.pear.php.net/package/PEAR-1.6.1.tgz .
After downloading, unzip and place PEAR in the inc directory. The expanded directory is as shown below:;
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, the PEAR installation is completed.