installing PEAR on windows XP with php 5.2.x

I had some rough time getting pear run on windows when it was such an easy task :)

Pear comes bundles with php 5.2.x and while installing php make sure that you customize the install to include pear and if you are installing any extensions you have the correct path setup for their libs otherwise you will get dll errors when you run php from command prompt. e.g in my install I selected all extensions however most of the extensions depended on other software on your machine and its lib’s to be included in the path, so unless you are going to use it don’t include it :)

Once php gets installed go to the php install folder which by default is at c:\program files\php (although I installed it at c:\php5 ) and run the command go-pear, this will ask you a set of questions, I accepted the default values which installed pear on my system. the pear executable is placed in the same folder as php.

Once pear was installed I also ran the registry file created by pear install to setup environment variables.

Once done I installed my required packages by using the command

pear install <package name>

the list of packages can be found at http://pear.php.net/packages.php

the name will be the name of individual package, e.g HTML_Form

pear install HTML_Form

this will download the package from the online repository and install it on your machine.

You might have to restart the web server to get it running.

That is it, if you have any questions then please do comment on this post or email me at imran@tb2.net

Happy coding :)

10 Responses

  1. i’am a newbie in PHP.. I’d like to ask how can i restart the web server?

  2. On windows you need to go to services control panel and restart IIS. the location of services control panel is start -> Programs -> Administrative Tools -> Services. Select IIS Admin services and then restart it.

  3. Hi,

    I installed php5.2, but test pear failed (by run PEAR::setErrorHandling(PEAR_ERROR_DIE);).

    I run go-pear.phar, but looked to change the tests path to the test code. Others the default. But failed.

    May you know what’s wrong?

    Thanks.

    John

  4. hopefully you’re using apache, not IIS. do the same as #2 above, but look for Apache instead of IIS.

    http://www.apache.org or look up WAMP or XAMP for an easier installer (PHP/MySQL/Apache/PHPMyAdmin Windows installer).

  5. Hi,

    got the following error

    C:\PHP>pear.bat
    ‘”C:\PHP\PEAR\”‘ is not recognized as an internal or external command,
    operable program or batch file.

  6. Hi!

    Thanks for this site. I am fairly new to PHP and PEAR and your site was the only one that listed the package installation…

    I am trying to send an email from PHP to myself. I need to use SMTP because I am on XP and don’t have an email server installed. My code is basic:

    <?php
    require_once “Mail.php”;

    $from = “Sandra Sender “;
    $to = “Ramona Recipient “;
    $subject = “Hi!”;
    $body = “Hi,\n\nHow are you?”;

    $host = “mail.example.com”;
    $username = “smtp_username”;
    $password = “smtp_password”;

    $headers = array (‘From’ => $from,
    ‘To’ => $to,
    ‘Subject’ => $subject);
    $smtp = Mail::factory(’smtp’,
    array (‘host’ => $host,
    ‘auth’ => true,
    ‘username’ => $username,
    ‘password’ => $password));

    $mail = $smtp->send($to, $headers, $body);

    if (PEAR::isError($mail)) {
    echo(“” . $mail->getMessage() . “”);
    } else {
    echo(“Message successfully sent!”);
    }
    ?>

    However, when I run it, I get an HTTP 500 internal error. The problem is the
    “$mail = $smtp->send($to, $headers, $body);” line. As soon as I comment it out, the page displays the message, but obviously does not send the email.

    Any hints on what the problem could be?

    Many thanks,

    Martin

  7. hi,
    i was configured php/mysql/apache. but i got the following errors.
    1. PECL::svn Install the PECL svn extension (and also PECL if you havent already done so). You can install from the command line using the command pecl install svn. Follow the installation instructions from the command line output to install the latest version. Once it is installed add extension=svn.so to /etc/php.d/svn.so and restart Apache.

    2. PEAR::Auth Install the PEAR Auth libary (and PEAR if you havent already done so). Groogle uses this for authenticating logons. You can install from the command line using the command pear install Auth. Once it is installed, restart Apache and try again.

    3. Pear::Text_Diff Install the PEAR Text_Diff extension (and PEAR if you havent already done so). You can install from the command line using the command pear install Text_Diff. Once it is installed, restart Apache and try again.

    please reply me as soon as possible

  8. it’s go-pear.phar in win XP

  9. Super-Duper site! I am loving it!! Will come back again – taking you feeds also, Thanks.

Leave a Reply