Compiling support for XSLT in PHP

XSLT, Extensible Stylesheet Language (XSL) Transformations is a language for transforming XML documents into other XML documents. It is a standard defined by The World Wide Web Consortium (W3C). Information about XSLT and related technologies can be found at http://www.w3.org/TR/xslt.

PHP XSLT extension only supports the Sablotron library from the Ginger Alliance. The extension does not come standard with Redhat Enterprise... and the compilation was a bit tricky. So if you are having difficulty, theses notes may help you some...

The versions I used as of this writing are:

  • Red Hat Enterprise Linux WS release 4 (Nahant Update 2)
  • php-4.3.9-3.9
  • sablotron-1.0.2-1.rf
  • js-1.5-1.2.el4.rf

Note: If you need xslt support with PHP 5 you can use the XSL extension.

 OK, lets get started:

  1. Get and install the latest js and js-devel RPMs from dags repository.
    # rpm -Uvh dag.wieers.com/packages/js/js-devel-1.5-1.2.el4.rf.i386.rpm 
    # rpm -Uvh dag.wieers.com/packages/js/js-1.5-1.2.el4.rf.i386.rpm
  2. Download Sablotron source RPM from dags repository.
    $ wget dag.wieers.com/packages/sablotron/sablotron-1.0.2-1.rf.src.rpm 
  3. Install the sablotron source RPM and remove "--with-readline" from the spec file.
    $ rpm -ivh dag.wieers.com/packages/sablotron/sablotron-1.0.2-1.rf.src.rpm 
    $ vi /usr/src/redhat/SPECS/sablotron.spec 

    [ begin remove ]
    --with-readline \
    [ end remove ]
  4. Build and install sablotron and sablotron-devel packages.
    $ rpmbuild -bb /usr/src/redhat/SPECS/sablotron.spec
    # rpm -Uvh /usr/src/redhat/RPMS/i386/sablotron*.rpm
  5. Download the php source RPM from Redhat.
    $ wget ftp.redhat.com/pub/redhat/linux/updates/enterprise/4WS/en/os/SRPMS/php-4.3.9-3.9.src.rpm
  6. Install the php source RPM and add, "--enable-xslt --with-xslt-sablot --with-sablot-js=%{_prefix}" to the spec file.
     $ rpm -ivh /usr/src/redhat/SRPMS/php-4.3.9-3.9.src.rpm 
     $ vi /usr/src/redhat/SPECS/php.spec 

    [ begin add ]
    --enable-xslt \
    --with-xslt-sablot \
    --with-sablot-js=%{_prefix} \
    [ end add ]
  7. Optionally add "BuildRequires: sablotron-devel, js-devel" to the spec file, helpful in stopping a build early if something is missing.
     [ begin add ]
    BuildRequires: sablotron-devel, js-devel
    [ end add ]
  8. On running rpmbuild, you may notice some additional missing dependencies.
  9. Install the missing packages. Most of what I had to install was devel packages.
    # up2date -i [missing-packages] 
  10. Build and force install the php packages.
     $ rpmbuild -bb /usr/src/redhat/SPECS/php.spec 
    # rpm -Uvh /usr/src/redhat/RPMS/i386/php* --force 
  11. Restart apache.
    # service httpd restart 
  12. Test with "<? phpinfo(); ?>". It should list XSLT support as being enabled.
  13. Edit the up2date config to skip future php updates.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Thanks!

Thanks for the sablotron compile tip! Removing the readline support the build proccess runs correctly!

google result

I noticed this blog coming up as the number 1 result on google with the keyword: "xslt php rpm" on google and it's not even been a month since the blog was posted... If you are looking for info or having difficulty, please don't hesitate to post here.

After spending three days

After spending three days searching for a way to make XSLT work on RHEL4 PHP4.3.9 sandip simple instructions fixed everything! Large learning cure this linux thing is but keep you young.

Comment