Getting and installing the PEAR package manager

个人技术博客:http://www.cooli.cc/

Windows

AfteryouhavedownloadedandinstalledPHP,youhavetomanuallyexecutethebatchfilelocatedine.g.c:\php\go-pear.bat.ThesetupwillaskyousomequestionsandafterwardsthePEARPackageManagerwillbeinstalledinthepath,whichyouhavespecifiedduringinstallation.

FinallyyouhavetoaddthatinstallationpathtoyourPATHenvironment.Eitherdothismanually(Start>ControlPanel>System>Environment)orrun(double-click)thenewlygeneratedPEAR_ENV.regthat'snowfoundinthePHPsourcedirectory.

AfterthatyoucanaccessthePEARPackageManagerbyrunningthecommandpearinaWindowsCommandPrompt.

ToupdateyourPEARinstallation,requesthttp://pear.php.net/go-pear.pharinyourbrowserandsavetheoutputtoalocalfilego-pear.phar.Youcanthenrun

php go-pear.phar

inaWindowsCommandPrompttostarttheupdateprocess.

Afterchangingphp.ini,youneedtorestartyourwebserver.

NowcheckthatPEARworks.

Unix/Linux/BSD

WhenusingPHP,thePEARPackageManagerisalreadyinstalledunlessonehasusedthe./configureoption--without-pear.

IfoneusesaversionofPHPthatissuppliedbyUnix/Linux/BSDdistributorsitmaybenecessarytomanuallyinstallPEAR.Usersshouldconsultthedocumentationfortherespectivedistributioninthiscase.

Ifyouwanttore-installthePackageManager,youcanusethefollowingprovisionalway:

$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar

SomeLinuxdistributions(e.g.Redhat)seemtobeusinglinksinsteadoflynxasthenamefortheircommandlinebrowser.Ifthisisthecaseforyou,youneedtochangetheabovelinecorrespondingly.

NowcheckthatPEARworks.

MacOSX

OnMacOS10.4andearlier,thePEARPackageManagerisalreadyinstalledin/usr/bin/pear.

IfyouareusingMacOS10.5(Leopard),wouldliketoinstallanewcopy,orre-installthePEARPackageManagerusethefollowingcommand:

$ wget http://pear.php.net/go-pear.phar
$ php -d detect_unicode=0 go-pear.phar

Forasystem-wideinstallation,youwillneedtoexecutethego-pearscriptwithincreasedpermissions.Thisisonlyrecommendedforadvancedusers.

$ wget http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar

NowcheckthatPEARworks.

PEARinhostingenvironments

Ifyouarerunningyoursiteatawebhostingproviderwithnodirectaccesstotheserver(vialocallogins,TelnetorSSH),youcanusethePEARInstallerusingtheWebFrontendor(S)FTP.

Gotogo-pearandsaveasgo-pear.php.Copygo-pear.phptoyourserverandopenthecorrespondingURLinyourbrowser,forexamplehttp://example.com/pear/go-pear.php.

Donotforgettoprotectthepeardirectoryifyoudidnotdoalreadybeforetheinstallation:Makeitunreadableandnotexecutablefromexternal(i.e.putitoutsidepublic_html).

NowcheckthatPEARworks.

src:http://pear.php.net/manual/en/installation.getting.php