PEAR Installation Tutorial

Installing PHP PEAR packages is pretty simple, but you need to make sure you have PHP and Apache correctly installed before you get started.

Installing PEAR

If you've correctly set your path in the windows system properties as described in my PHP installation tutorial, then installing PEAR will be extremely simple. Step 1)Open up the run window by holding the windows key and pressing R. Type in "cmd" and press enter to bring up the command prompt. Bring up the run window Alternatively, you can open the command prompt in the accessories folder of the start menu. Bring up the command prompt Step 2)Once the command prompt is open, change the current directory to the php directory. If you followed my php installation tutorial, your php folder is located at C:\webserver\php. So to change to the directory in the command prompt, you would type:
cd C:\webserver\php
(cd stands for Change Directory in the command prompt. ) Once you press enter, you should see that the directory has changed in my case from C:\Users\Joseph to C:\webserver\php. Change the directory Step 3)Now that you are in the php directory, type in
go-pear.bat
This loads the pear installation batch file that came with PHP. You will be prompted with the question: "Are you installing a system-wide PEAR or a local copy?" You can type in either system or local as your response. I chose system. Press Enter. Enter go-pear.bat Step 4)A wall of text will hit your screen. PEAR is basically allowing you to change installation directories if you wish. If you want to keep everything in the default installation directories (which I recommend), then press Enter. PEAR will begin to install, and you will see a lot of text, until you come across this message: Pear Warning Type in Y and press enter. When prompted, press enter again. You will see
The 'pear' command is now at your service at c:\webserver\php\pear.bat
Pear is now ready Step 5)You are also told a registry file named PEAR_ENV.reg has been created in the php directory. Pear Registry Configuration Open up your php directory (C:\webserver\php) and look for the PEAR_ENV.reg file. When you locate it, double click it and grant it permission. Step 6)Installing PEAR Packages: Now that you have PEAR installed, you can start installing some packages. A list of the most useful and most downloaded PEAR Packages can be found at the PEAR Projects official website. For this example, let's install HTML_Template_IT, which is a way to use integrated templates with PHP. Step 7)If you have closed the command prompt, open it up again and make sure you are in the C:\webserver\php directory. (Refer to step 2 if you can't remember how to switch directories) Step 8)Now simply type in
pear install HTML_Template_IT
into the command prompt, press enter, and it will install! Installing with Pear Step 9)If you want to uninstall a PEAR Package, you follow the same procedure but type "uninstall" instead of install. So to uninstall HTML_Template_IT, you would go to the command prompt and type
pear uninstall HTML_Template_IT
Uninstalling with Pear That concludes the installation of Pear.

Warning: require_once(Structures/Graph/Node.php)

If you've come across this error while installing PEAR, Max has left us a potential solution in the comments. Let us know if it works! February 28, 2010
About the Author:

Joseph is the lead developer of Vert Studios Follow Joseph on Twitter: @Joe_Query
Subscribe to the blog: RSS
Visit Joseph's site: joequery.me