How to install PEAR packages on XAMPP Windows

XAMPP is used by Windows users to simulate the LAMP stack.
The most common thing that I need to do is install PEAR packages for my various projects / experiments. On Linux box its simple – on Windows with XAMPP you do some preparatory steps first.

I am using xampplite on Windows 7 but, you can follow these steps for xampp and Windows vista too.
This is the version of my xampp: XAMPP for Windows Version 1.7.1

Steps:

  1. Add your PHP installation path to your PATH environment variable. Mine is C:\xampplite\php – this path can change as per your installation
  2. Open the command prompt and go to C:\xampplite\php
  3. Double click the go-pear.bat file and follow the installation steps (I chose system and just pressed enter for all the steps leaving everything else as it is)
  4. At the end of the installation a new file ‘pear.bat‘ will be created in php folder
  5. The go-pear installation would have also updated your php.ini file to add the PEAR path to the include_path variable – still, we need to verify it.
  6. Open you php.ini file (in the php folder) and search for include_path. Ensure that your PEAR folder is there in this path. My final include_path looks like this:
    include_path=”.;C:\xampplite\php\pear;C:\xampplite\php\PEAR\”
  7. Restart your Apache and start a fresh command prompt screen
  8. Now, you can use the ‘pear‘ command to install your PEAR packages.
    For example, I installed the Digg package like this:
    pear install Services_Digg2-alpha
  9. That’s it! You should be able to use your PEAR package in your scripts.

Setup multiple copies of xampp in a server

To install multiple copies of xampp in 1 Terminal Server, simply do the following steps

1. Download and Install the first copy of xampp in your system
2. During installation, you can uncheck the services asked for installation as shown here
3. After installation, Start xampp and Browse xampp i.e http://localhost/
4. You will see the Home page of xampp
5. Stop xampp for now.
6. Install xampp again, but ensure that you give another folder name.
7. Here also uncheck the services and install.
8. After installation, go to the second installed directory and edit the file httpd.conf under xampp2/apache/conf
(Here I have given the name of 2nd directory as xampp2)
9. Inside that file, locate the area shown below:
Listen 12.34.56.78:80
Listen 80
10. Change the above code as follows:
Listen 12.34.56.78:81
Listen 81
11. Start the new xampp and browse as http://localhost:81/
12. You will see a different instance of xamp running.
13. Like this you can create several instances of xampp and if clients are connected to a server system, users can work in their induvidual copies of xampp.
You have done!!!

Magento, Fatal Error while installing

I got the following fatal error while trying to intall Magento 1.3.2.4 in XAMPP 1.7.3
Fatal error: Method Varien_Object::__tostring() cannot take arguments in C:\xampp\htdocs\magento\lib\Varien\Object.php on line 488

Follow the steps given below to fix this issue:-
1)File: /lib/Varien/Object.php (Line 484)
Change from
public function ___toString(array $arrAttributes = array(), $valueSeparator=’,’)
To this
public function __invoke(array $arrAttributes = array(), $valueSeparator=’,’)

2)File /app/code/core/Mage/Core/Controller/Request/Http.php (Line 274)
Change from
$host = split(‘:’, $_SERVER[‘HTTP_HOST’]);
To this
$host = explode(‘:’, $_SERVER[‘HTTP_HOST’]);

Set up XAMPP on usb drive or make a portable XAMPP without drive letter

Download XMAPP (version 1.7.1 or greater) from http://www.apachefriends.org/en/xampp-windows.html,  and install it in your hard drive (C: or D:). After that, open xampp folder and double-click on setup_xampp.bat file. Then you will get a window like this:

xampp setup window

xampp setup

From the menu list choose 2 ( relocate XAMPP ), and press enter key, then you will get a window like following:

xampp setup menu

xampp setup

press y and enter.
Now your XAMPP became portable and you can copy it to your usb drive!