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.

http://in.php.net/xslt/
(please chk the comments on)
http://www.indexdata.dk/keystone/doc/redhat.tkl

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
http://sourceforge.net/projects/expat/ (check for latest)
wget http://telia.dl.sourceforge.net/sourceforge/expat/expat-1.95.8.tar.gz
tar -pxzf expat-1.95.8.tar.gz
cd expat-1.95.8
./configure
make
make install

*Make sure that /etc/ld.so.conf contains /usr/local/lib
then run
ldconfig

Get the source from http://www.gingerall.com
http://download-1.gingerall.cz/download/sablot/Sablot-1.0.2.tar.gz
tar -pxzf Sablot-1.0.2.tar.gz
cd Sablot-1.0.2
export CXXFLAGS=-lstdc++
./configure --prefix=/usr --with-expat --with-iconv
make
make install
ldconfig

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.
Else

  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:
     PHP_SETUP_ICONV(XSLT_SHARED_LIBADD, [], [
    AC_MSG_ERROR([iconv not found, in order to build sablotron you
    need the iconv library])
    ])
  6. now
    phpize
    ./configure --enable-xslt --with-xslt-sablot=/usr/local + (the original configure options)
    make
    su
    make install
  7. xslt.so 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 extension=xslt.so.

Thursday, September 15, 2005

installing SMTP on windows 2003 server

A. The version of Microsoft IIS that ships with Windows 2003 contains a service that you can use to deliver mail using SMTP. To install this SMTP service, perform the following steps:

  1. Start the Control Panel Add/Remove Programs applet.
  2. Click Add/Remove Windows Components.
  3. After the Windows Components Wizard appears, select Applications Server and click Details.
  4. Select Internet Information Services (IIS), then click Details.
  5. Select SMTP Service, then click OK.
  6. Continue to click OK to close all other dialog boxes until you're back at the Windows Components Wizard page, then click Next.

Windows 2003 will copy the files required for the SMTP service (you might be prompted to insert the installation CD-ROM) and configure the service. You can also install the SMTP service through the E-mail Services tool, which is a POP3 component that automatically installs SMTP. Windows 2003 configures the SMTP service to use a default server, and you can use the IIS Manager to modify the server settings.

Tuesday, July 05, 2005

connecting to derby using servlets in apache tomcat

for accessing derby

copy derby.war from DERBY_INSTALL/lib to TOMCAT_INSTALL/webapps
and db2jcc*.jar (2 files) from DERBY_INSTALL/lib to TOMCAT_INSTALL/common/lib

Friday, July 01, 2005

PHP odbc functions

problem with odbc_num_rows and odbc_fetch_array in linux. (i use Redhat 9)


odbc_num_rows
on most *nix machines with unixODBC driver it returns -1 in both cases ie. if u find some rows or if u dont find any row. so u cant to use odbc_num_rows to check whether a row exists or not
for eg you can use
if(odbc_num_rows($result) > 0)
{
do something
}
on windows platform.

but for *nix u cant.

so instead use the following function

function better_odbc_num_rows($result)
{
$count=0;
while($temp = odbc_fetch_into($result, &$counter))
{
$count++;
}
return $count;
}

and use
if(better_odbc_num_rows($result) > 0)
{
do something
}

odbc_fetch_array

in *nix

odbc_fetch_array does not exist on some machines. so use

odbc_fetch_into($result, $array);