Adobe Flex Authors: Matthew Lobas, PR.com Newswire, Shelly Palmer, Kevin Benedict

Related Topics: Adobe Flex

Adobe Flex: Article

Configuring and Testing PHP Servers for XSL Support

Transformations in a snap

The major breakthrough in Macromedia Dreamweaver 8 is visual authoring with XML data. You can now perform both client-side and server-side XSL transformations in a snap. I covered XML syntax in one of my previous articles. I also presented the XSL syntax and covered the differences between a server-side and a client-side transformation in my article, XSL Overview. Finally, in the article, Consuming a Remote RSS Feed with Dreamweaver 8, I show you how to consume a remote feed in your site, using the XSL Transformation server behavior in Dreamweaver 8.

This article explains how to install and configure XML and XSL support for your web server, in order to be able to perform server-side XSL transformations. The article covers the configuration of PHP application servers - versions 4 and 5 - for Windows, Macintosh, and Linux operating systems.

In a server-side XSL transformation, the server performs the actual work of producing HTML output using pre-installed libraries for XML and XSL support. In a client-side transformation, however, the client's browser does the work of fetching the XML and XSL files and producing the HTML output. The downside of this approach is that not all browsers have XML/XSL support, so some of your clients might not be able to see your pages. There are also other advantages to server-side XSL transformations:

  • The file containing the XML data can reside on your own server or anywhere else on the web.
  • Any browser can display the transformed data.
Quickly Testing Your PHP Server for Server-Side XSL Transformation Capability

Your PHP server may already be set up to do XSL transformations. You can quickly test it by following these steps:

  • Download the sample files linked below.
  • Unzip the ZIP file into your web root and upload the entire xslt_test folder to your web server running PHP.
Open a browser and browse to the test.php file on your server. If you receive an error, please continue reading this article. I will show you how to configure and test your PHP server for XSL transformations. If the test.php page returns a list of articles from the Macromedia Developer Center, I encourage you to read my article, Consuming a Remote RSS 1.0 Feed with Dreamweaver 8, in which I will show you how to build the test.php page.

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:

  • Open Dreamweaver.
  • In a site defined with a testing server, create an empty PHP page (File > New).
  • Switch to Code view.
  • 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.
  • Save your page to something like test.php and upload it to the testing server.
  • Load the page in your browser, to see the results, using F12 (Windows) or Option + F12 (Macintosh).
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 (Figure 1). 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:
  • For PHP 4.3+:
    zlib (on Mac OS only)
  • For PHP 4.2:
    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.

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.

Configuring PHP 4.2 Servers
If you're using PHP 4.2.x, I advise you to upgrade to the latest PHP version for the following reasons:

  • XML and XSL libraries for PHP 4.2 are deprecated and never really reached a truly stable state.
  • Support for XML and XSL has been rewritten from scratch in PHP 5 to offer greater speed, improved memory management, and compliance to W3C standards. You can read more about the XML improvements in PHP 5 in Christian Stoker's article.
  • PHP 5 offers more XML support by default and is a lot easier to configure.
If, however, you are restricted to using PHP 4.2.x as your application server, you must have the following libraries for performing XSL server-side development:
  • Expat
  • iconv
  • Sablotron
Expat is an open-source XML parser. It must be installed prior to Sablotron, as it is required by this library. To learn more about Expat, visit the SourceForge website. Sablotron is an open-source XSLT processor. You can find out more about Sablotron from the Ginger Alliance website. To install these libraries on your server, follow the instructions corresponding to your operating system. It is likely that Expat is already built-in into your PHP or Apache installation.

Configuring PHP 4.2 Servers on Windows
The following instructions assume you have already installed a web server with PHP language support on a computer running Windows. Before proceeding with the installation steps, check if the required libraries are not already installed on your server by loading the PHP test page in your browser.

  • If Expat is already enabled, you can skip steps 1-3.
  • If both Expat and Sablotron are installed, but XSL support is not enabled, you can skip steps 1-7.
  • If both Expat and Sablotron are installed, and XSL support is enabled, you can skip this section altogether. Your server is already configured for server-side development using XML data.
  • Download the latest version of Expat for Linux from the SourceForge.net website. The file you're looking for is named expat_win32bin.exe.
  • Run the downloaded file to install Expat to a folder of your choice on the server.
  • Locate the expat.dll file in the libs subdirectory of the Expat installation, and copy it to the system32 subdirectory of your Windows installation (usually, C:\Windows\system32\).
  • Copy the iconv.dll file from the dlls folder of your PHP installation to the system32 subdirectory of your Windows installation. This is a character set conversion library required by Sablotron.
  • Download Sablotron 0.90 from the Ginger Alliance website. Look for the Windows binary release.
  • Extract the ZIP file contents to a folder of your choice on your computer. This creates a folder called Sablot-0.90.
  • Locate the sablot.dll file in the bin subdirectory of your Sablotron installation and copy it to the system32 subdirectory of your Windows installation (usually located at C:\Windows\system32\).
  • Locate the php.ini configuration file for your current PHP installation (usually located in C:\Windows\) and open it using any text editor (such as Notepad).

    Note: You can find out where the PHP configuration file (php.ini) is located on your system by loading the PHP test page containing the server information in your browser. Look for the Configuration File Path setting:

  • Search for the following line:
  • extension_dir
  • Make sure the value of this directive is set to the extensions directory of your PHP installation and that this line is uncommented. For instance, if your PHP installation is located in C:\PHP, the line should be as follows:
  • extension_dir = C:\PHP\extensions
  • Search for the following line in the php.ini file:
  • extension=php_xslt.dll
  • If this line is missing, locate the Windows Extensions section of the php.ini file and copy it there. If this line is commented, that is, it starts with the semicolon (;) character, uncomment it by deleting the semicolon to enable XSLT support.
  • Save the php.ini file.
  • Restart your web server.

More Stories By Marius Zaharia

Marius Zaharia is the documentation manager at InterAKT Online, a developer of professional tools for dynamic web development. When he's not writing articles and tutorials to guide web developers, he enjoys learning new things and exploring new technologies. His interests range from web development to politics and avantgarde electronic music.

More Stories By Cristian Ivascu

Cristian Ivascu is a technical writer with InterAKT Online. He is a strong supporter of open-source software and a fan of Japanese culture and rock music.

Comments (4) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

Most Recent Comments
thnx 04/25/06 08:40:25 AM EDT

thanks for the links

Marius 04/25/06 08:18:20 AM EDT

Sorry, first one is:

Marius 04/25/06 08:17:06 AM EDT

Here they are:
XML Overview: http://www.macromedia.com/devnet/dreamweaver/articles/xml_overview.html\

XSL Overview:

KF 04/20/06 10:14:33 AM EDT

This was a great article, it would have been nice to have links to the other two articles mentioned in the opening paragraph (XML Syntax and XSL overview). Is it possible to send me links to those articles?

Thanks in advance, KF

@ThingsExpo Stories
Personalization has long been the holy grail of marketing. Simply stated, communicate the most relevant offer to the right person and you will increase sales. To achieve this, you must understand the individual. Consequently, digital marketers developed many ways to gather and leverage customer information to deliver targeted experiences. In his session at @ThingsExpo, Lou Casal, Founder and Principal Consultant at Practicala, discussed how the Internet of Things (IoT) has accelerated our abilit...
In his keynote at 19th Cloud Expo, Sheng Liang, co-founder and CEO of Rancher Labs, discussed the technological advances and new business opportunities created by the rapid adoption of containers. With the success of Amazon Web Services (AWS) and various open source technologies used to build private clouds, cloud computing has become an essential component of IT strategy. However, users continue to face challenges in implementing clouds, as older technologies evolve and newer ones like Docker c...
Data is the fuel that drives the machine learning algorithmic engines and ultimately provides the business value. In his session at Cloud Expo, Ed Featherston, a director and senior enterprise architect at Collaborative Consulting, discussed the key considerations around quality, volume, timeliness, and pedigree that must be dealt with in order to properly fuel that engine.
No hype cycles or predictions of zillions of things here. IoT is big. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, Associate Partner at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He discussed the evaluation of communication standards and IoT messaging protocols, data analytics considerations, edge-to-cloud tec...
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settl...
In his session at @ThingsExpo, Dr. Robert Cohen, an economist and senior fellow at the Economic Strategy Institute, presented the findings of a series of six detailed case studies of how large corporations are implementing IoT. The session explored how IoT has improved their economic performance, had major impacts on business models and resulted in impressive ROIs. The companies covered span manufacturing and services firms. He also explored servicification, how manufacturing firms shift from se...
IoT is at the core or many Digital Transformation initiatives with the goal of re-inventing a company's business model. We all agree that collecting relevant IoT data will result in massive amounts of data needing to be stored. However, with the rapid development of IoT devices and ongoing business model transformation, we are not able to predict the volume and growth of IoT data. And with the lack of IoT history, traditional methods of IT and infrastructure planning based on the past do not app...
Organizations planning enterprise data center consolidation and modernization projects are faced with a challenging, costly reality. Requirements to deploy modern, cloud-native applications simultaneously with traditional client/server applications are almost impossible to achieve with hardware-centric enterprise infrastructure. Compute and network infrastructure are fast moving down a software-defined path, but storage has been a laggard. Until now.
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
The best way to leverage your CloudEXPO | DXWorldEXPO presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering CloudEXPO | DXWorldEXPO will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at CloudEXPO. Product announcements during our show provide your company with the most reach through our targeted audienc...
DXWorldEXPO LLC announced today that All in Mobile, a mobile app development company from Poland, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. All In Mobile is a mobile app development company from Poland. Since 2014, they maintain passion for developing mobile applications for enterprises and startups worldwide.
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
JETRO showcased Japan Digital Transformation Pavilion at SYS-CON's 21st International Cloud Expo® at the Santa Clara Convention Center in Santa Clara, CA. The Japan External Trade Organization (JETRO) is a non-profit organization that provides business support services to companies expanding to Japan. With the support of JETRO's dedicated staff, clients can incorporate their business; receive visa, immigration, and HR support; find dedicated office space; identify local government subsidies; get...
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
"We view the cloud not as a specific technology but as a way of doing business and that way of doing business is transforming the way software, infrastructure and services are being delivered to business," explained Matthew Rosen, CEO and Director at Fusion, in this SYS-CON.tv interview at 18th Cloud Expo (http://www.CloudComputingExpo.com), held June 7-9 at the Javits Center in New York City, NY.
DXWorldEXPO LLC announced today that the upcoming DXWorldEXPO | CloudEXPO New York event will feature 10 companies from Poland to participate at the "Poland Digital Transformation Pavilion" on November 12-13, 2018.
As data explodes in quantity, importance and from new sources, the need for managing and protecting data residing across physical, virtual, and cloud environments grow with it. Managing data includes protecting it, indexing and classifying it for true, long-term management, compliance and E-Discovery. Commvault can ensure this with a single pane of glass solution – whether in a private cloud, a Service Provider delivered public cloud or a hybrid cloud environment – across the heterogeneous enter...
DXWorldEXPO LLC announced today that ICC-USA, a computer systems integrator and server manufacturing company focused on developing products and product appliances, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City. ICC is a computer systems integrator and server manufacturing company focused on developing products and product appliances to meet a wide range of ...
More and more brands have jumped on the IoT bandwagon. We have an excess of wearables – activity trackers, smartwatches, smart glasses and sneakers, and more that track seemingly endless datapoints. However, most consumers have no idea what “IoT” means. Creating more wearables that track data shouldn't be the aim of brands; delivering meaningful, tangible relevance to their users should be. We're in a period in which the IoT pendulum is still swinging. Initially, it swung toward "smart for smart...
Major trends and emerging technologies – from virtual reality and IoT, to Big Data and algorithms – are helping organizations innovate in the digital era. However, to create real business value, IT must think beyond the ‘what’ of digital transformation to the ‘how’ to harness emerging trends, innovation and disruption. Architecture is the key that underpins and ties all these efforts together. In the digital age, it’s important to invest in architecture, extend the enterprise footprint to the cl...