| One, what is PEAR? Pear is the official open source class library for PHP, the abbreviation for PHP Extension and application repository. Pear is the meaning of pears in English. Pear the PHP program development process commonly used in the function of writing into a class library, covering the page surface, database access, file operations, data structure, caching operations, network protocols and many other aspects, users can be very convenient to use. Second, why use pear? PHP is a very good scripting language, concise and efficient, with the release of 4.0, more and more people use it for dynamic website development, it can be said that PHP has become one of the best Internet development language, especially for those who need to be able to quickly, PHP is the preferred language for developers of web sites that develop small-to-medium-sized business applications efficiently. But with the increasing application of PHP, the lack of uniform standards and effective management of these applications, it is difficult for the PHP community to share each other's code and applications as easily as people in the Perl community, Because PHP lacks a unified code base like CPAN to classify and manage the code modules of the application (everyone familiar with Perl knows that Cpan is a huge Perl extension module repository, the application modules can be placed under the appropriate directory under CPAN, others can be easily reused, Of course, you also need to follow the guidelines when you write application modules. For this reason, pear came into being and, starting with 4.04, was distributed along with the PHP core. Three, what benefits can pear bring to me? 1. As mentioned earlier, Pear manages the Pear application code base according to a certain classification, your pear code can be organized into the appropriate directory, others can easily retrieve and share your results. 2.PEAR is not just a code warehouse, it is also a standard, using this standard to write your PHP code, will enhance the readability of your program, reusability, reduce the chance of error. 3.PEAR provides you with 2 classes to build a framework that implements such functions as destructors, error trapping, which you can use with inheritance. Four, what is the purpose of Pear's offer? A PHP user's open source (open-sourced) Code Organization library A code distribution and package maintenance and system is written in PHP Standard style PHP basic class (PFC) PHP extension Common library (PECL), more detailed in the following a support Php/pear community website, Mailing list and download image Five, pear What are the introductory materials available for viewing? PHP Pear Official station Http://pear.php.net/PHP Pear Chinese station http://www.pearchina.com/ PHP pear manual http://pear.phpv.net/cn/Use pear to write your next PHP program http://www.ibm.com/developerworks/cn/linux/sdk/php/pear1/ |
、
Today on the Internet to read a lot about the pear installation of the document, including the installation of pear.php.net, because there is no real installation process, see I have some foggy, I do not know why. Here are some of my understanding of pear installation.
The pear documentation says that, as long as you install PHP 4.3.0 and do not use the "./configure flag--without-pear" option, the Pear base installation is integrated into the system. Other pear packages are installed through the Pear Setup Manager, and the installation manager is already in the system. However, if you use installer to install PHP under Windows, you do not have the pear installed in the system. If you install PHP according to the. zip package file, you can extract the pear directly into the pear directory, but it is not installed in the system. Also the documentation about the Pear package installed in Windows is obsolete.
Therefore, if you press installer to install PHP, you can install the pear into the system (if you do not use PHP installer to install PHP, you can refer to the following content):
Download the. zip php installation files, such as: Php-4.3.6-win32.zip.
Unlock one of the two directory CLI and pear and one file Go-pear.bat to the directory installed in PHP.
Under the command line to the PHP directory, run Go-pear.bat (the content is actually
cliphp.exe-d output_buffering=0 peargo-pear.php) It will give you to install Pear commands and install some pear packages
Enter the HTTP proxy service (such as http://192.168.0.1:808) and enter directly if no proxy server is available
If the current path defaults to correct, press Enter and modify if necessary
Tip The following package is bundled with PHP. Select Y
... Prompt for a local package, prompting for successful installation
If there are no include_path entries in the php.ini, use pear if there is a problem, and you are prompted to modify the php.ini. Answer y, prompted to modify the PHP.ini
Press ENTER, the installation is complete, you have created pear.bat in the PHP directory, you can use it later, and some pear packages installed in the Pear directory. You can use Pear_nev.reg in the PHP directory to easily modify environment variables, double-click to
Pear list to see the package, pear Help file
In fact, until now to install pear in the Windows environment in PHP, Include_path has the Pear directory.
Also on the Linux machine, like my virtual host, does not provide shell permissions, with phpinfo () view, no pear information. But it doesn't. Use the "./configure flag--without-pear" option. However, the pear package must not be used, so that they specifically installed pear as if it is impossible. How to use pear on a virtual host like this? Here's my process:
Download the required packages, such as the base package pear-1.3.1.tgz and the database package db-1.6.2.tgz
Unzip the package to a local
Create an include folder on the host virtual directory. Htdoc or. www. Then upload the extracted documents to the directory (such as DB package can only upload db.php and DB directory, PEAR package upload os,pear,script directory and pear.php file)
Because the php.ini file cannot be modified, we add the following script file to use the package:
Ini_set ("Include_path", '/var/.../includes/'). Path_separator. Ini_get ("include_path"));
?>
Then you can use the pear, as follows:
Require_once "db.php";
$mime = ...
?>
OK, now you can use PHP's pear on both Windows and Linux.