PHP Pear Installation

Source: Internet
Author: User
Tags deprecated
Transferred from: http://wangye.org/blog/archives/266/

What is Pear

From Baidu Encyclopedia: Pear is the abbreviation for PHP extension and application library (the PHP Extension and application Repository). It is a code repository for PHP extensions and applications, in short, pear to php like Cpan (Comprehensive perl Archive Network) to Perl.

This shows that pear is the repository of PHP code, here can find a lot of useful code, to avoid us to repeat some features, but the Pear code package is not directly downloaded through the HTTP website, we need to install pear.

How to obtain and install pear

Recommendation: The following operations in the Windows 7 environment, the same applies to the Windows xp/2003/vista/2008 system, some of the operation is tentative, in order to avoid detours, it is recommended to read this article before the relevant operation.

If the PHP directory does not have its own pear, Can not find the go-pear.php file, then we need to manually download the go-pear.php file, click here to download and save as go-pear.php, this file is placed in the Php.exe PHP installation directory, I install the directory is D:\ PHP5 (This is the directory below), then the go-pear.php location should be D:\php5\go-pear.php.

Begin? Run, enter cmd, start the command prompt, enter the following command, mainly switch to the go-pear.php directory, and then execute the PHP script file:

123
CD d:\php5d:php go-pear.php

Unfortunately, due to my PHP version is too new, the above operation prompts failed, the specific information is as follows:

Deprecated:assigning The return value of new by reference was Deprecated in D:\php5\go-pear.php on line 733

sorry! Your PHP version is too new (5.3.8) for this go-pear.

Instead use Http://pear.php.net/go-pear.phar for a more stable and current version of Go-pear, more suited to your PHP ver Sion.

Thank your coopertion and sorry for the inconvenience!

It means to ask us to download the Go-pear.phar file to Http://pear.php.net/go-pear.phar, and then replace go-pear.php to try again. Download the Go-pear.phar file and put it in the D:\php5 folder, and execute the following command:

123
CD d:\php5d:php Go-pear.phar

This appears:

12
Is you installing a system-wide PEAR or a local copy? (system|local) [System]:

Press ENTER to default system and continue. The following are the default pear settings for temporary, data, configuration, test, and execution directories:

12345678910111213141516171819
Below is a suggested the file layout for your new PEAR installation.  Tochange individual locations, type the number in front of thedirectory.  Type ' All ' to change all of them or simply press Enter toaccept these locations. 1. Installation Base ($prefix): D:\PHP5 2. Temporary directory for processing:d:\php5\tmp 3. Temporary directory for downloads:d:\php5\tmp 4. Binaries DIRECTORY:D:\PHP5 5. PHP Code directory ($php _dir): D:\php5\pear 6. Documentation Directory:d:\php5\docs 7. Data Directory:d:\php5\data 8. user-modifiable configuration Files Directory:d:\php5\cfg 9. Public Web Files DIRECTORY:D:\PHP5\WWW10. Tests DIRECTORY:D:\PHP5\TESTS11. Name of the configuration file:c:\windows\pear.ini12. Path to CLI php.exe:d:\php5 1-12, "all" or EnterTo continue: 

Direct enter use the default value and continue with the installation. I thought everything was going to be all right, but there was a mistake here:

Warning:date (): It is not safe for rely on the system ' s timezone settings. You is *required* to use the Date.timezone setting or the Date_default_timezone_set () function. In case you used any of those methods and you is still getting this warning, your most likely misspelled the timezone Iden Tifier. We selected ' UTC ' for ' 8.0/no DST ' instead in phar://d:/php5/go-pear.phar/pear/registry.php on line 1012
Pear_config::writeconfigfile fopen (' C:\Windows\pear.ini ', ' W ') failed (fopen (C:\Windows\pear.ini): Failed to open Stream:permission denied)

It seems that there is no permission to write to C:\Windows\pear.ini, because I am using a Windows 7 system, and then the normal user opened a command prompt, here of course no permission to write to the C:\Windows directory, it seems to be a further alternative. Back to just is you installing a system-wide PEAR or a local copy? This paragraph, why not choose local copy? Online are directly say the default return to select System, do not want to overwrite the C:\Windows directory, so I re-execute PHP go-pear.phar, and choose Local.

123
Is you installing a system-wide PEAR or a local copy? (system|local) [System]: Localplease confirm local copy by typing ' yes ': Yes

Okay, this is normal,:-).

1
Would to alter PHP.ini 
     
     
      
      ? [y/n]:
     
     

Then the above sentence, only select Y agree to modify the php.ini.

123456
PHP.ini 
     
     
      
       include_path updated. Current include path           :.; C:\php\pearConfigured directory           : D:\php5\pearCurrently used PHP.ini (guess): D:\php5\php.iniPress Enter to Continue:
     
     

Then appear above this paragraph, there seems to be nothing good change, direct enter confirm can.

Here should be able to see thanks for using go-pear! This sentence, then congratulate you, Pear finally is installed successfully!

How to install the pear package

Next, let's go to the Pear website and see what we need. Pear Each package has a prompt to install commands, such as MDB2 this package, the above has been prompted to use the Pear Install MDB2 command installed, assuming the directory or D:\PHP5, then we use the following command to try:

123
CD d:\php5d:pear Install MDB2

As a result, the following error occurred:

12345
D:\php5>pear Install mdb2downloading mdb2-2.4.1.tgz ... Starting to download mdb2-2.4.1.tgz (119,790 bytes) ..... ... done:119,790 byteserror:failed to mkdir C:--------- \php\pear\docs\mdb2\docs\examples

Unable to create the directory, it seems to be a privilege problem, simply start the cmd command prompt as an administrator, and then re-execute the above command. This is a successful installation. Install ok!

Well, about pear I introduced here, more usage still refer to pear website

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.