PHP Pear Installation Configuration Tutorial _php Tips

Source: Internet
Author: User
Tags deprecated pear php script

What is pear?

PEAR is an abbreviation of the PHP extension and the application library (the PHP Extension and application Repository). It's a code warehouse for PHP extensions and apps, simply put, Pear's php is like CPAN (Comprehensive Perl Archive Network) to Perl.

This shows that pear is the repository of PHP code, where you can find a lot of useful code to avoid us to write some functionality, but the Pear code package is not directly downloaded through the HTTP Web site, we need to install pear.

How to get and install pear

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

If the PHP directory does not 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 of the PHP installation directory, I install the directory is D:\ PHP5 (The following is the catalogue), then the go-pear.php position should be D:\php5\go-pear.php.

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

CD D:\PHP5
D:
PHP go-pear. php
Unfortunately, because my PHP version is too new, the above operation prompts the failure, the specific information is as follows:

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

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

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

Thank for your coopertion and sorry for the inconvenience!

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

CD D:\PHP5
D:
PHP Go-pear.phar
This occurs:

Are 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 settings for pear's temporary, data, configuration, test, and execution directories:

Below is a suggested file layout for your new PEAR installation.
to change individual locations, type the number in front of the
directory. Type ' All ' to "change all" them or simply press Enter to
accept 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\www
10. Tests directory        : D:\php5\tests
11. Name of configuration file     : C:\Windows\pear.ini
12. Path to CLI php.exe       : D:\php5
 
1-12, "all" or Enter to continue:

Direct carriage return uses the default value and continues the installation. I thought everything was all right, but there was a mistake here:

Warning: date (): It is isn't safe to rely on the system ' s timezone settings. You are are *required* to use the Date.timezone setting or the Date_default_timezone_set () function. In case you are used any of those methods and your are still getting this warning, for you 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 the Windows 7 system, and then the normal user opened the command prompt, where there is certainly no permissions to write to the C:\Windows directory, it seems to be a further alternative. Back to are you just now installing a system-wide PEAR or a local copy? This paragraph, why not choose local copy? The internet is directly to say that the default carriage return select system, do not want to overwrite the C:\Windows directory, so I rerun the PHP go-pear.phar, and select Local.

Are you installing a system-wide PEAR or a local copy?
(system|local) [System]: Local
Please confirm the local copy by typing ' yes ': Yes

Okay, this is normal,:-).

Would to alter PHP.ini <D:\PHP5\PHP.INI>? [y/n]:
then the above sentence, only choose Y agree to modify php.ini.

PHP.ini <D:\php5\php.ini> include_path updated.
 
Current include path   :.; C:\php\pear
configured directory   : D:\php5\pear
currently used php.ini (guess): D:\php5\php.ini
Press Enter to continue:

Then appear above this paragraph, it seems that there is nothing good to change, direct return confirmation can be.

You should be able to see the thank for using go-pear! here, so congratulations, pear is finally installed successfully!

How to install the Pear package package

Next let's go to the Pear website and see what you need. Pear Each package has a hint to install the command, such as MDB2 this package, 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:

CD D:\PHP5
D:
Pear Install MDB2
The result is the following error:

D:\php5>pear Install MDB2
downloading mdb2-2.4.1.tgz ...
Starting to download mdb2-2.4.1.tgz (119,790 bytes)
... ... done:119,790 bytes ERROR:, I am not the same as the other.--
Failed to mkdir C:\php\pear\docs\MDB2\docs\examples

Unable to create the directory, it appears to be a permissions issue, simply start the cmd command prompt as an administrator, and then execute the above command again. The installation was successful, install ok!.

Another example of a setup report: PHP Pear installation appears warning:require_once (structures/graph.php) ... Error

In Windows installation pear, all the way to install the complete, and then want to install the Pear email packet to play, but then reported:

Warning:require_once (structures/graph.php): Failed to open stream:no such file
or directory in pear\downloader.php on line 1217
PHP warning:require_once (structures/graph.php): Failed to open stream:no such
File or directory in E:\Program files\php5_3\pear\pear\pear\downloader.php on L
INE 1217
Novice can not, online find solutions. For a long while, it was a mistake. The reason is very clear is that less structures_graph this pear application, the direct General Pear command:
Pear Install structures_graph-1.1.1
Online installation of this application, but it is sad to even report the same mistake, I lost.

Don't play with it. Download structures_graph-1.1.0.tgz package directly to Pear website. Unpack and look inside the structure; find that there is a structures/graph.php in it; then unzip and put the structures folder in the zip bag under the pear root. Then run the structures_graph installation command, surprise!! It worked.

Then install the email, no accident also success. To this tangled up my half-day problem finally solved.

Thank you all for reading Oh!

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.