Sunday, February 21, 2010

Installing the Pear Classes

If you've been doing FileMaker custom web development using PHP, you've probably heard of PEAR. PEAR (short for "PHP Extension and Application Repository") is a collection of PHP code that performs many common functions. PEAR packages either provide enhanced versions of functionality that is built into PHP itself, or provide functionality that PHP lacks. For a list of packages that PEAR provides, go to: http://pear.php.net/packages.php

This post describes how you can install PEAR packages on Windows-based servers where FileMaker's version of PHP was installed as part of the FileMaker Server (or Server Advanced) installation.

To get started, open up a Command Prompt. (From the Start menu, select All Programs, Accessories, and Command Prompt.)

At the DOS prompt, enter: CD C:\Program Files\FileMaker\FileMaker Server\Web Publishing\publishing-engine\php

Next, enter: pear

A list of available PEAR commands should be presented.

To install a PEAR package, type "pear install " and then the name of the package that you want to install. For example, to install the PEAR mail library, you would enter: pear install mail

As the package installs, you'll see progress information. For example:

Did not download dependencies: pear/Net_SMTP, use --alldeps or --onlyreqdeps to
download automatically
pear/Mail can optionally use package "pear/Net_SMTP" (version >= 1.1.0)
downloading Mail-1.1.14.tgz ...
Starting to download Mail-1.1.14.tgz (17,537 bytes)
......done: 17,537 bytes
install ok: channel://pear.php.net/Mail-1.1.14


Notice that in this example, the package that was installed is dependent upon another package. In this case, the package is dependent upon the PEAR Net_SMTP package. To install it, you would enter: pear install net_smtp

That's all!

2 comments:

cindy said...

Can you load PECL extensions, too?

Anonymous said...

Note that the latest version 1.2 (or newer) of pear mail requires a newer pear installer then comes with FileMaker Server. You can still install an old version of mail:
pear install Mail-1.1.14

or install new installer of pear.