Search This Blog

Thursday, December 29, 2005

PHP 4.3 + XSLT + Expat + Sablot + Fedora Core 3

While trying to configure xslt for PHP 4.3, you experience the problem of
Call to undefined function: xslt_create()

You have configured PHP with --enable-xslt --with-xslt-sablot. You google. Everyone tells you to recompile your PHP using the above options and it works. You tear off your hair as you have already used the options but you still get the error. You dont get much help anywhere. You think of leaving out the xslt part or even leaving PHP completly.
Then you find something regarding PHP5. You think of upgrading to PHP5 to avoid such frustrations as PHP5 uses DOM.

If this is your story you are at the right place because i have been through the same. I wasted around 2 days searching for it.
After much search i found 2 pages that helped me get through though not completly.
(please chk the comments on)

For PHP4 to use xslt you need to install expat and sablot in the given order.

How to install sablotron with PHP
You need to first install expat, followed by Sablotron. Then you need to reinstall PHP. This is the method we used :-

Get source for expat (check for latest)
tar -pxzf expat-1.95.8.tar.gz
cd expat-1.95.8
make install

*Make sure that /etc/ contains /usr/local/lib
then run

Get the source from
tar -pxzf Sablot-1.0.2.tar.gz
cd Sablot-1.0.2
export CXXFLAGS=-lstdc++
./configure --prefix=/usr --with-expat --with-iconv
make install

Sablot has a seg fault bug. Install its patch.

try reinstalling PHP with --enable-xslt --with-xslt-sablot. If you dont get the Call to undefined function: xslt_create() error, you are lucky.

  1. Check the version of PHP installed. Simplest option would be run page with as you would need the original configure options.
  2. Download the PHP source for same version.
  3. Extract the source. cd to the source dir. Then cd ext/xslt.
  4. vi config.m4 (steps 4 and 5 may not be needed)
  5. comment these 3 lines:
    AC_MSG_ERROR([iconv not found, in order to build sablotron you
    need the iconv library])
  6. now
    ./configure --enable-xslt --with-xslt-sablot=/usr/local + (the original configure options)
    make install
  7. is created in modules directory in srcdir/ext/xslt/modules copy it to /usr/lib/php4. Change its permissions.
  8. cd /usr/local/lib. Change the permissions for libexpat.a and libsablot.a.

And bingo!
Its done.
For RH8 and RH9 you may need to add

No comments: