Saturday, April 30, 2011

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:\xampp\php 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=\xampp\php\pear”


Add following line above this line.

SET “PHP_PEAR_INSTALL_DIR=C:\xampp\php\PEAR”


Now include c:\xampp\php 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.

7 comments:

  1. 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

    ReplyDelete
  2. 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.

    ReplyDelete
    Replies
    1. Thanks for your comment. There are many ways to solve one problem. It depends on us which way we choose.

      Delete
    2. 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:\xampp\php\pear
      plz help

      Delete
  3. Thank you. It worked fine. This post indeed saved me time.

    Canbeiro

    ReplyDelete
  4. Thank you SREEJITH it is working for me.

    Zahid

    ReplyDelete
  5. This page helped me alot, thanks every body

    ReplyDelete