How to install or uninstall pear packages in xampp for windows

Hello

Recently I had some tough time installing pear packages in xampp so I am sharing procedure here so that it can help you.

First of all go to folder c:xamppphp and find the file pear.bat. In my case I installed xampp in c drive. If its not in c drive go to the correct path and find pear.bat file.

Open that file in Notepad or Notepad++ to edit. Find the following line in in that file.

IF “%PHP_PEAR_INSTALL_DIR%”==”” SET “PHP_PEAR_INSTALL_DIR=xamppphppear”


Add following line above this line.

SET “PHP_PEAR_INSTALL_DIR=C:xamppphpPEAR”


Now include c:xamppphp to PATH environment variable.

In windows vista you can find it here.

Start->Control Panel->System and Maintenance->System->Advanced System Settings->Environment Variable

That’s it and now go to command prompt and type command pear. You will see all the possible options for that command.

Use following command to install pear package.

pear install -o ‘path of package’

Use following command to uninstall pear package.

pear uninstall ‘pearname’

Generally name of pear is directory name inside php/pears folder.

Hope this post saves your time.

This entry was posted in Pear, PHP, xampp on by .

About Hiren Dave

Hiren Dave is a software engineer, blogger and consultant with over 9 years of professional experience. He writes code in number of languages. Hiren has a passion for developing web apps, mobile apps and writing books and blog articles about programming. He has a solid experience of startups as he manages products for few startups. He is also passionate about researching and learning new technologies and trends. He has also authored a book Instant Sencha Touch, published by Packt and creator of Video Course "Beginning Laravel" for Packt

5 thoughts on “How to install or uninstall pear packages in xampp for windows”

  1. Anonymous

    Hi, i tried doing the above procedure. When i ran this on the cmd prompt

    pear install -o Spreadsheet_Excel_writer

    what came out were these error messages:

    No release available for package "pear.php.net/Spreadsheet_Excel_Writer"
    Cannot initialize 'channel://pear.php.net/Spreadsheet_Excel_Writer', invalid or missing package file
    Package "channel://pear.php.net/Spreadsheet_Excel_Writer" is not valid
    install failed

    can u help out?
    Thanks in advance

    Reply ↓
  2. SREEJITH

    No need to go through these steps. You can simply install any pear package in Xaamp by doing the following steps.

    Go to the Xaamp control panel and click shell button. It will open a cmd window. Type pear install pear_package_name. (pear_package_name means name of your pear package you want to install).

    For example you can type pear install Net_GeoIP-1.0.0 to install Net_GeoIP pear package. But you need an active internet connection to do this. This also canbe done offline too if you already downloaded the package.

    Reply ↓
  3. Anonymous

    I am getting an error
    # pear install
    PHP_PEAR_INSTALL_DIR is not set correctly.
    pearcmd.php could not be found there.
    Please fix it using your environment variable or modify
    the default value in pear.bat
    The current value is:
    D:xamppphppear
    plz help

    Reply ↓

Leave a Reply

Your email address will not be published. Required fields are marked *