Institutional Knowledge

Wherein we write down some stuff that we know.

Institutional Knowledge header image 2

RHEL 4 and php-xslt

September 20th, 2006 · 2 Comments

It all started out innocently enough…a JIRA issue for me to install the PHP XSLT module. How hard could it be? When you ask yourself that question immediately realize that you are in trouble.

You’re running the stock RedHat PHP rpm. RedHat Network doesn’t provide an rpm for php-xslt. So you need to build a php-xslt rpm from source. How do you do that and avoid all the issues we ran into? Good question.

  1. Get and build a js rpm from source.
    1. rpm -i js-version.srpm
    2. rpmbuild -bb /usr/src/redhat/SPECS/js.spec
    3. install js and js-devel rpms
  2. Get and build a sablotron rpm from source. You need to build from source to avoid problems later on that I will explain.
    1. rpm -i sablotron-version.srpm
    2. Edit /usr/src/redhat/SPECS/sablotron.spec to remove the --with-readline configure option. If PHP tries to load a module that dynamically links to readline, it will barf.
    3. rpmbuild -bb /usr/src/redhat/SPECS/sablotron.spec
    4. install sablotron and sablotron-devel rpms
  3. Get and install php source from RHN
    1. up2date --get-source php
    2. rpm -i /var/spool/up2date/php-version.srpm
  4. Patch php.spec to enable php-xslt. A patch that works against php-4.3.9-3.15 is available here or here.
    1. cd /usr/src/redhat
    2. patch -p0 < /path/to/patch (You should see that 5 hunks succeeded.)
    3. Edit php.spec so that %{!?xslt:%define xslt 0} says %{!?xslt:%define xslt 1}
  5. Build and install php
    1. rpmbuild --bb /usr/src/redhat/SPECS/php.spec
    2. rpm -U --replacepkgs --force --hash /path/to/php /path/to/php-xslt
    3. service httpd reload

How hard could it be, indeed…

Technorati tags: ,

Tags: HOWTO · PHP · Web Development

2 responses so far ↓

  • 1 Neurinux // Oct 10, 2006 at 1:47 am

    1- I compiled libiconv in /usr/local/lib
    2- I copiled Sablotron and installed it with “./configure —with-iconv /usr/local/lib —enable-encoding”
    3- I compiled xslt.so from sources with “./configure —enable-iconv —enable-xslt —with-xslt-sablot —with-iconv-dir=/usr/local/lib —with-expat-dir”
    then “cp modules/xslt.so /usr/lib/php4/ ” and setup xslt.ini to load extension
    4- I restarted Apache

    Now I have php-xslt running but also a ” PHP Fatal error: Call to undefined function: xslt_set_encoding()” error.”

    I googled all day but no solution…

    HELP

  • 2 pberry // Oct 12, 2006 at 1:51 pm

    Does phpinfo() say that xslt is enabled?