By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,409 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,409 IT Pros & Developers. It's quick & easy.

PHP Sybase Extension

P: n/a
I would like to use PHP's Sybase extension. I am running my development
area on Windows under IIS. When I enable the Sybase extension, I get a
message that indicates the extension didn't load. After doing some digging
I have learned that in order for the Sybase extension to work
(php_sybase_ct.dll) I need libct.dll.

After Googling libct.dll and php_sybase_ct.dll and following several
threads, it appears that many people have had the same problem and come to
the same conclusion but no where did I find the information on where to
actually find libct.dll. A search of the Sybase web site didn't yield
anything either.

Can anyone enlighten me as to what I need to install and more importantly,
where to get it from in order to get past this obstacle?

Thanks,

Mike

--
Mike Walsh - mike_walsh at mindspring.com
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
ljb
mi********@mindspring.com wrote:
I would like to use PHP's Sybase extension. I am running my development
area on Windows under IIS. When I enable the Sybase extension, I get a
message that indicates the extension didn't load. After doing some digging
I have learned that in order for the Sybase extension to work
(php_sybase_ct.dll) I need libct.dll.

After Googling libct.dll and php_sybase_ct.dll and following several
threads, it appears that many people have had the same problem and come to
the same conclusion but no where did I find the information on where to
actually find libct.dll. A search of the Sybase web site didn't yield
anything either.

Can anyone enlighten me as to what I need to install and more importantly,
where to get it from in order to get past this obstacle?


If you were developing on Unix/Linux, I would suggest using freetds for the
low-level library. On Windows, it might be better to use the PHP ODBC
extension instead of the PHP sybase_ct extension. Can your application use
ODBC instead? But the general answer to your question is that the low-level
library like libct.dll (or ODBC) has to come with the database software.
No, Sybase doesn't make it available separately as far as I know, and in
fact they don't even make it easy to find out how to buy it (apart from
being included in the database product). But if your Windows box can talk
to the database (with Sybase central, for example) then it already has the
low-level ODBC drivers from Sybase, and PHP should be able to use those
with the ODBC extension.
Jul 17 '05 #2

P: n/a

"ljb" <lj****@mindspring.com.nospam> wrote in message
news:qO*****************@newsread1.news.atl.earthl ink.net...
mi********@mindspring.com wrote:
[ ... snipped ... ]

If you were developing on Unix/Linux, I would suggest using freetds for the low-level library. On Windows, it might be better to use the PHP ODBC
extension instead of the PHP sybase_ct extension. Can your application use ODBC instead? But the general answer to your question is that the low-level library like libct.dll (or ODBC) has to come with the database software.
No, Sybase doesn't make it available separately as far as I know, and in
fact they don't even make it easy to find out how to buy it (apart from
being included in the database product). But if your Windows box can talk
to the database (with Sybase central, for example) then it already has the
low-level ODBC drivers from Sybase, and PHP should be able to use those
with the ODBC extension.


Can you elaborate on freetds? The application is developed on a Windows
environment but will be deployed on a Sun so I actually need to solve both
problems.

I have actually started looking into the ODBC solution and have been able to
create a connection via Excel so I assume I can use the same datasource for
PHP. However, I am struggling with how exactly to make this work.

I have set up an ODBC Data Source using Windows XP's Data Source (ODBC)
Control Panel utility. I am able to connect to the database without any
problem. I have given this datasource a name "Sample Data Source".

Now how would I create the proper connection with PHP? I am using PEAR DB
and did the following:

//The hostname that has the Database
define("DB_HOSTNAME", "odbc.server.com");
define("DB_PORT", "1000");

//The username and password
define("DB_USERNAME", "db_username");
define("DB_PASSWORD", "db_password");

//The DB name to use
define("DB_NAME", "sample_database");

//The DB DSN
define("DB_DSN", "odbc://" . DB_USERNAME . ":" . DB_PASSWORD . "@" .
DB_HOSTNAME . ":" . DB_PORT . "/" . DB_NAME) ;

$dbh = DB::connect(CQ_DB_DSN, true) ;

if (DB::isError($dbh))
{
die(sprintf("%s(%s): %s", basename(__FILE__), __LINE__,
$dbh->getMessage())) ;
}
else
{
print "Database connection successful." ;
}

$dbh->disconnect() ;

The values in the PHP defines are the same as those I used to create the
ODBC connection via the Windows Control Panel. Should my DSN reference the
name I used to create the ODBC connection? What would a valid DSN then look
like?

Thanks for any guidance.

Mike
--
Mike Walsh - mike_walsh at mindspring.com
Jul 17 '05 #3

P: n/a
ljb
mi********@mindspring.com wrote:
...
Can you elaborate on freetds? The application is developed on a Windows
environment but will be deployed on a Sun so I actually need to solve both
problems.
...


I can't help with the ODBC part because I haven't used it. I have used
freetds. Home site is http://www.freetds.org and project site is
http://sourceforge.net/projects/freetds/
This is an open-source implementation of the TDS protocol, which was
developed by Sybase and also used by Microsoft. Freetds includes 3
libraries which aim to be call-compatible with Sybase's CT-lib, DB-lib, and
ODBC library. I've found freetds to be very usable, although the developers
still consider it "alpha" test. I use freetds with the PHP sybase-ct extension.

Don't forget that there are two Sybase databases, too: ASA (a.k.a. SQL
Anywhere) and ASE. There are differences but freetds talks to both. I'm
using freetds on Linux to talk to ASA (running on Netware, if you can
believe it).
Jul 17 '05 #4

P: n/a
You need to get the sybase client libary (or install the client on the
webserver where php runs).

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.