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.
- Get and build a js rpm from source.
rpm -i js-version.srpmrpmbuild -bb /usr/src/redhat/SPECS/js.spec- install
jsandjs-develrpms
- Get and build a sablotron rpm from source. You need to build from source to avoid problems later on that I will explain.
rpm -i sablotron-version.srpm- Edit
/usr/src/redhat/SPECS/sablotron.specto remove the--with-readlineconfigure option. If PHP tries to load a module that dynamically links to readline, it will barf. rpmbuild -bb /usr/src/redhat/SPECS/sablotron.spec- install
sablotronandsablotron-develrpms
- Get and install php source from RHN
up2date --get-source phprpm -i /var/spool/up2date/php-version.srpm
- Patch
php.specto enable php-xslt. A patch that works againstphp-4.3.9-3.15is available here or here.cd /usr/src/redhatpatch -p0 < /path/to/patch(You should see that 5 hunks succeeded.)- Edit
php.specso that%{!?xslt:%define xslt 0}says%{!?xslt:%define xslt 1}
- Build and install php
rpmbuild --bb /usr/src/redhat/SPECS/php.specrpm -U --replacepkgs --force --hash /path/to/php /path/to/php-xsltservice httpd reload
How hard could it be, indeed…
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?