XSL transforms in PHP for Linux

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jonah
Forum Commoner
Posts: 31
Joined: Fri Jun 20, 2003 12:23 am

XSL transforms in PHP for Linux

Post by jonah »

Slackware Linux 9.0 machine with Apache 1.3.27, MySQL 3.23.56
and PHP 4.3.1 constitutes the Web environment in which I would
like to add XSLT capabilities. I understand from various sources
that I will have to add to this setup, libiconv and sablotron.

The current setup (phpinfo) reveals the following XML capabilities:

XML Support active
XML Namespace Support active
EXPAT Version 1.95.2

I have attempted to run some of the XSLT examples described
in the PHP manual, but of course cannot get past the most
preliminary directive $xsltproc = xslt_create(); which produces
the Apache error_log message:

[Tue Jun 24 21:38:14 2003] [error] PHP Fatal error:
Call to undefined function: xslt_create() in ...

I don't want to recompile PHP from source to add XSLT capability
and was wondering if there is a binary add-on for Sablotron
or some other way to add transforms without disturbing my
current setup?

Any help or suggestions appreciated.
User avatar
enygma
Site Admin
Posts: 175
Joined: Fri Apr 19, 2002 8:29 am
Location: Dallas, Tx

Post by enygma »

Yup, here's the steps you'll need to take:

- Download the Sablotron libraries from here: http://www.gingerall.com/charlie/ga/xml/d_sab.xml
- Install them and get that working
- recompile PHP with the following options included with your others:
--enable-xslt --with-xslt-sablot
- hopefully, if you installed the Sablotron stuff somewhere it can find it, it should have no issues.

Once that finishes, try out a sample call to xslt_process or just make a phpinfo() page.....
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Re: XSL transforms in PHP for Linux

Post by cactus »

jonah wrote:I don't want to recompile PHP from source to add XSLT capability and was wondering if there is a binary add-on for Sablotron or some other way to add transforms without disturbing my current setup?
You can't get away from it, the extensions are only available once you have compiled PHP (with ext. libs) to use them.

I don't use Slackware's packages for PHP (as I like to have my own config) but they may provide you with a binary of PHP that can link (ldso) with the libs you require.

Regards,

BTW, nice to see a fellow Slackware user on the board ;)
jonah
Forum Commoner
Posts: 31
Joined: Fri Jun 20, 2003 12:23 am

Post by jonah »

Yes, but I was trying to avoid recompiling PHP from source;
I'd just as soon keep the binary distribution intact.

I notice that there is an extension for MySQL

usr/lib/php/extensions/mysql.so

and am wondering, if something similar would appear if I
recompiled with xslt/sablotron, could I bypass the compile step
and add the extension manually?

Now, don't laugh, maybe it can be done. After all the php manual
talks about an extension API.
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post by cactus »

You still have to "make" "make install" to create the binary, recompiling the source will not result in a *.so for your DOM/XSL libs.

(I can't believe I'm going to say this...) Windows is better for adding extensions in the manner as all you need to do is add it to the config. (... no flames please, I do have Win32 friends!) ;)

Sorry.

Regards,
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

there are dynamic extension on linux systems, too.
Couldn't find the package you need for slackware but take a look at the redhat page (e.g. http://www.redhat.com/swr/i386/php-ldap-4.2.2-17.i386.html)
Not the xslt package but just proof that there are precompiled extensions on *nix-systems ;)
http://www.php.net/manual/en/install.configure.php wrote:For a complete up-to-date list of configure options, run ./configure --help in your PHP source directory after running autoconf (see also the Installation chapter).
this e.g. includes --enable-shared[=PKGS]
jonah
Forum Commoner
Posts: 31
Joined: Fri Jun 20, 2003 12:23 am

Post by jonah »

Following up on volka's comment, has anyone used the Slack
rpm2tgz utility to try to install or at least look at the Redhat
rpm PHP binary he refer's to?

I would think that trying to install a binary meant for a RedHat
distribution on a Slack system would probably create a non-working
setup but you never know till you try.
Post Reply