Skip navigation

installing php pear extensions

Well, i always forget how this is done, but its actually really easy.

  1. Navigate to your php install directory. for me, i go start-> run -> cmd.exe
    cd\apache2.2\php
    

    You PHP install dir may be different. If you used xampp, its probably C:\xampp\php. The default location of Apache 2.2 if you install it by itself is something like c:\program files\apache software foundation\apache2.2\php

  2. Then at that command prompt, say I want to add the Math_Numerical_RootFinding PEAR package to my php install:
    C:\Apache2.2\php>pear install Math_Numerical_RootFinding
    

And that’s it! PHP automatically resolves the network connection and downloads the latest build of the package.

IF the package you’re trying to get is still in BETA (as some of the good ones seem to be stuck in a perpetual beta), then you would have to pay attention to the error message that appears when you try to install it.

So for example, I wanted the Math_Polynomial package, so I try:

pear install Math_Polynomial

But it comes back at me with

Failed to download pear/Math_Polynomial within preferred state “stable”, latest release is version 0.1.0, stability “beta”, use “channel://pear.php.net/Math_Polynomial-0.1.0” to install
Cannot initialize ‘channel://pear.php.net/Math_Polynomial’, invalid or missing package file
Package “channel://pear.php.net/Math_Polynomial” is not valid
install failed

So you have to do:

pear install Math_Polynomial-0.1.0

Which works.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: