Accessibility

Table of Contents

Configuring and Testing PHP Servers for XSL Support

Determining Your PHP Server Version and Whether it Supports XSLT

How Do I Know Which PHP Version I Have?

To find out which libraries you need for performing server-side XSL transformations, you need to determine which PHP version is currently running on your web server. To do that, follow these steps:

  1. Open Dreamweaver.
  2. In a site defined with a testing server, create an empty PHP page (File > New).
  3. Switch to Code view.
  4. Inside the body tag, type the following line of code:

    <?php phpinfo() ?>

    In your browser, this function will display detailed information about the current PHP installation and settings, modules, libraries, and so on.

  5. Save your page to something like test.php and upload it to the testing server.
  6. Load the page in your browser, to see the results, using F12 (Windows) or Option + F12 (Macintosh). The browser displays a page similar to the following figure:

    Figure 1. Viewing details about your current PHP installation

    Figure 1. Viewing details about your current PHP installation

Note: On some systems, the phpinfo() function is disabled for security reasons. In this case, you will receive a warning that this function doesn’t exist or your browser will display a white page. You'll have to remove this function from the disable_functions list in the php.ini file or ask your system administrator to do it.

The PHP version is listed on top of the page. Depending on your current PHP version, you need the following XML/XSL libraries:

  • For PHP 4.2 – Sablotron
  • For PHP 4.3+ – DOM/XML
  • For PHP 5 – DOM and XSL extensions

In the next section, you will learn how to check if your server already has these libraries installed and configured.

How Do I Know If I Have XML/XSL Support?

On the same page that you have created and loaded in the browser previously, test.php, look for these settings, depending on your PHP version:

  • For PHP 5:

    • DOM/XML
    • libXML
    • XSL
    • libxslt
  • For PHP 4.3+:

    • DOM/XML
    • DOM/XSLT
    • libxslt
    • libxml
    • zlib (on Mac OS only)
  • For PHP 4.2:

    • Expat
    • XSLT Support

If these settings are marked as enabled or active, then you have what you need to process XML documents on the server.

Note: For libxml, libxslt, and Expat, only the version number may be listed (instead of the enabled/disabled status); this indicates they are present on your server.

If any of these libraries are missing or are disabled on your server, then your server is not configured to enable XSL. If you usually dive head-first into your projects and don't like to spend time configuring your server, you might have already encountered this error:

MM_XSLTransform error.
The server could not perform the XSL transformation because an XSLT processor for PHP could not be found. Contact your server administrator and ask them to install an XSLT processor for PHP.

The error is displayed on the dynamic page where you have applied the XSL Transformation server behavior in Dreamweaver 8, as you can see in the following figure:

Figure 2. XSL Transformation warning error

Figure 2. XSL Transformation warning error

The error message is an indication that your server does not have the required XML/XSL libraries.

To learn how to apply the XSL Transformation server behavior, see the section, Applying a Server-Side XSL Transformation to the RSS Feed, in my previous article.

In general, PHP servers require two components to enable XSL:

  • a library (that usually comes with your PHP installation for your operating system)
  • a PHP extension using that library

These two components may vary, according to your current PHP version and may also have other prerequisite modules. Go to the next section to find how to install what you need.