note 58234 added to ref.sybase
| From: | sean dot healey at bayernlb dot co dot uk | Date: | Fri, 28 Oct 2005 10:42:58 +0000 |
| Subject: | note 58234 added to ref.sybase | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97734@lists.php.net to get a copy of this message | ||
I've finally got PHP 5.0.5 running under Apache2 on Solaris 8 ... connecting to Sybase ASE
servers 12.0 and 12.5 using CT-LIB 12.5.
The following was my build procedure -
Build Apache:
./configure \
--prefix=/usr/local/apache2 \
--enable-so
make
make install
Edit httpd.conf, adjusting directives to suit the local environment.
Following advice given above, update the Sybase version string in the PHP sybase_ct module header
file:
vi /var/build/php-5.0.5/ext/sybase_ct/php_sybase_ct.h
change this line ...
#define CTLIB_VERSION CS_VERSION_100
...to...
#define CTLIB_VERSION CS_VERSION_125
Build PHP:
SYBASE=/..../..../sybase12_5 <<-- path to your Sybase distribution root
SYBASE_OCS=OCS-12_5
LD_LIBRARY_PATH=$SYBASE/$SYBASE_OCS/lib
export SYBASE SYBASE_OCS PATH LD_LIBRARY_PATH
./configure \
--prefix=/usr/local/php \
--with-sybase-ct=$SYBASE/$SYBASE_OCS \
--enable-static=sybase-ct \
--with-apxs2=/usr/local/apache2/bin/apxs \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm
make
make test
NOTE: 'make test' will almost certainly fail all of the Sybase functionality, unless you
update the test include file to use valid connectivity details for your local server:
vi /var/build/php-5.0.5/ext/sybase_ct/tests/test.inc
// Change if needed
define('HOST', '****');
define('USER', '****');
define('PASSWORD', '****');
make install
Edit Apache's httpd.conf file to associate .php files with a MIME type:
#
# PHP script support
#
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
Edit the apachectl script, inserting the following variable declarations after environment variables
are imported:
SYBASE=/..../..../sybase12_5
SYBASE_OCS=OCS-12_5
LD_LIBRARY_PATH=$SYBASE/$SYBASE_OCS/lib:$LD_LIBRARY_PATH
export SYBASE SYBASE_OCS LD_LIBRARY_PATH
Ensure you have an 'interfaces' file in the root of your sybase distribution (Above the
OCS-12_5 subdirectory), containing a server entry in the following format for each server you want
to connect to:
dataservername_ds
<tab> master tcp ether <hostname> <port>
<tab> query tcp ether <hostname> <port>
(if this is your dataserver machine, there will be at least 1 entry already for the local
dataserver. It is advisable to install all of the above on a separate machine though, with its own
copy of the sybase client)
Cross fingers, and:
apachectl start
If you get 'relocation' errors when starting Apache with the php module configured to
load, check the output of 'ldd libphp5.so'. Each of the Sybase libraries should link to
files under your Sybase client distribution:
ldd /usr/local/apache2/modules/libphp5.so
libtcl.so => /.../sybase12_5/OCS-12_5/lib/libtcl.so
libintl.so.1 => /.../sybase12_5/OCS-12_5/lib/libintl.so.1
libcomn.so => /.../sybase12_5/OCS-12_5/lib/libcomn.so
libct.so => /.../sybase12_5/OCS-12_5/lib/libct.so
libcs.so => /.../sybase12_5/OCS-12_5/lib/libcs.so
...
<snip other libraries>
...
If you see 'libintl.so' linking anywhere else, this is likely because the PHP build has
incorrectly linked to a slightly different filename - libintl.so.1 - which doesn't exist in the
Sybase client. Unfortunately a completely unrelated library of the same name does exist elsewhere in
Unix! (Apparently the Sybase version was created before the duplicate was introduced into Unix).
My workaround was to create the following symlink in sybase client library 'lib' directory
-
libintl.so.1 -> ./libintl.so*
'make distclean' in your PHP build directory, and repeat the build as above.
----
Manual Page -- http://www.php.net/manual/en/ref.sybase.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58234
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58234&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58234&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58234&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58234&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58234&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58234&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58234&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58234&report=yes
Search -- http://master.php.net/manage/user-notes.php