Sunday, February 21, 2010

Enabling the PHP SSL Extension

If you're using the PEAR mail class to send messages via a mail server that requires connections via SSL (such as Google's SMTP servers), you might run into this error:

Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (code: -1, response: )]

This is typically an indication that you need to enable PHP's SSL extension.

On Windows-based servers where FileMaker's version of PHP was installed as part of the FileMaker Server (or Server Advanced) installation, you can enable the SSL extension as follows:

First, find and open your PHP configuration file (php.ini). It should be located here: C:\Program Files\FileMaker\FileMaker Server\Web Publishing\publishing-engine\php

Next, scroll down until you see a list of PHP extensions. You should see a line that looks like this: ;extension=php_openssl.dll

Remove the ";" at the beginning of the line, and then save your changes to the file.

Next, cycle IIS.

At that point, the SSL extension should be enabled.

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!

Thursday, February 18, 2010

Enabling the PHP SOAP Extension

I've been burned by this one a few times, so I thought I'd share it here...

If you install PHP as part of the FileMaker Server for Windows installation process, PHP's SOAP extension (as well as several other extensions) will be installed. However, the extension is disabled by default.

To enable it (and other extensions), do this:

1. Find the php.ini file. The default location is: C:\Program Files\FileMaker\FileMaker Server\Web Publishing\publishing-engine\php

2. Edit the file, and scroll down until you see the "Dynamic Extensions" area.

3. In the list of extensions, add this line:

extension=php_soap.dll

4. Save the changes.

5. Cycle IIS.

At that point, the extension will be enabled and ready for use.

For more information about the PHP SOAP extension, see: http://www.php.net/manual/en/book.soap.php