If you're using PHP 4.2.x, I advise you to upgrade to the latest PHP version for the following reasons:
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 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.
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.
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:
Figure 3. Locating your php.ini file
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.
To check if the configuration went smoothly, read the section, Testing PHP 4.2 Servers.
The following instructions assume you have already installed a web server with PHP language support on a computer running Linux. Before proceeding with the installation instructions, check if the required libraries are not already installed on your server by loading the PHP test page in your browser.
Download the latest version of Expat for Linux from the SourceForge.net website. The source file you're looking for is called expat-1.95.8.tar.gz.
Note: The version number may be different at the time you download the package. The version used in the following instructions was the latest version at the time of writing this article. Please make sure you use the version number you have in the next instructions.
Extract the archive contents to a directory of your choice using the following command:
tar xzvf expat-1.95.8.tar.gz
Unix creates a directory called expat-1.95.8, which contains the files for compiling and installing Expat.
Go to the expat-1.95.8 directory and run the following commands at the command prompt, in the given order:
./configure –-prefix=/usr make make install
Expat is now installed on your server.
Download Sablotron 0.90 from the Ginger Alliance website. The source file you're looking for is called Sablot-0.90.tar.tar.
Note: The version number may be different at the time you download the package. The version used in the following instructions was the latest at the time of writing this article. Please make sure you use the version number you have in the next instructions.
Extract the source archive as you did for Expat, using the following command:
tar xzvf Sablot-0.90.tar.tar
Linux creates a directory called Sablot-1.0.2, which contains the files for installing and compiling Sablotron.
Go to the Sablot-0.90 directory and run the following commands at the commands prompt, in the given order (make sure you are logged in as root):
./configure -–prefix=/usr make make install
Sablotron is now installed on your server.
./configure \ --prefix=/usr/local/php \ --with-config-file-path=/usr/local/php \ --with-apxs=/usr/sbin/apxs \ --enable-xslt \ --with-xslt-sablot=/usr
Note: The flags used above only enable Sablotron and XSLT support. Add any other flags that might be necessary for your own configuration, such as MySQL support, LDAP, FTP, and so on.
Also, the path to your current PHP installation may be different than /usr/local/php, depending on your settings or the Linux/Unix version you are using.
Compile PHP:
make
Reinstall PHP:
make install
To check if the configuration went smoothly, read the section, Testing PHP 4.2 Servers.
The following instructions assume you have already installed a web server with PHP language support on a computer running Mac OS. Before proceeding with the installation instructions, check if the required libraries are not already installed on your server by loading the PHP test page in your browser.
Extract the library to a folder of your choice, using StuffIt Expander, or the tar command-line utility:
tar xzvf expat-1.95.8.tar.gz
./configure –with-prefix=/usr
Compile the library:
sudo make
sudo make install
The Expat library should be correctly installed.
Extract the Sablotron library to a folder of choice, using StuffIt Expander, or the tar command-line utility:
tar xzvf Sablot-0.90.tar.gz
Run the configuration scripts for your system, by executing the following command:
./configure –with-prefix=/usr
Compile the library:
sudo make
Execute the following command to install the library:
sudo make install
Configure PHP for XSLT support. To do that, execute the following commands in this sequence:
./configure --enable-xslt --with-xslt-sablot --with apxs
Note: The flags used above only enable Sablotron and XSLT support. Add any other flags that might be necessary for your own configuration, such as MySQL support, LDAP, FTP, and so on.
Recompile PHP:
sudo make
Install PHP (overwriting any other existing version):
sudo make install
To check if the configuration went smoothly, read the section, Testing PHP 4.2 Servers.