php访问sybase16

一、cd /path/to/php-5.6.16/ 进入PHP源码目录 

二、cd ext/sybase_ct

三、修改php_sybase_ct.c把涉及到mssql_等函数的代码注释掉(否则mssql模块不能同时加载),具体修改如下

/*

#if !defined(PHP_WIN32) && !defined(HAVE_MSSQL)

PHP_FALIAS(mssql_connect, sybase_connect, arginfo_sybase_connect)

PHP_FALIAS(mssql_pconnect, sybase_pconnect, arginfo_sybase_pconnect)

PHP_FALIAS(mssql_close, sybase_close, arginfo_sybase_close)

PHP_FALIAS(mssql_select_db, sybase_select_db, arginfo_sybase_select_db)

PHP_FALIAS(mssql_query, sybase_query, arginfo_sybase_query)

PHP_FALIAS(mssql_unbuffered_query, sybase_unbuffered_query, arginfo_sybase_unbuffered_query)

PHP_FALIAS(mssql_free_result, sybase_free_result, arginfo_sybase_free_result)

PHP_FALIAS(mssql_get_last_message, sybase_get_last_message, arginfo_sybase_get_last_message)

PHP_FALIAS(mssql_num_rows, sybase_num_rows, arginfo_sybase_num_rows)

PHP_FALIAS(mssql_num_fields, sybase_num_fields, arginfo_sybase_num_fields)

PHP_FALIAS(mssql_fetch_row, sybase_fetch_row, arginfo_sybase_fetch_row)

PHP_FALIAS(mssql_fetch_array, sybase_fetch_array, arginfo_sybase_fetch_array)

PHP_FALIAS(mssql_fetch_assoc, sybase_fetch_assoc, arginfo_sybase_fetch_assoc)

PHP_FALIAS(mssql_fetch_object, sybase_fetch_object, arginfo_sybase_fetch_object)

PHP_FALIAS(mssql_data_seek, sybase_data_seek, arginfo_sybase_data_seek)

PHP_FALIAS(mssql_fetch_field, sybase_fetch_field, arginfo_sybase_fetch_field)

PHP_FALIAS(mssql_field_seek, sybase_field_seek, arginfo_sybase_field_seek)

PHP_FALIAS(mssql_result, sybase_result, arginfo_sybase_result)

PHP_FALIAS(mssql_affected_rows, sybase_affected_rows, arginfo_sybase_affected_rows)

PHP_FALIAS(mssql_min_client_severity,   sybase_min_client_severity, arginfo_sybase_min_client_severity)

PHP_FALIAS(mssql_min_server_severity, sybase_min_server_severity, arginfo_sybase_min_server_severity)

PHP_FALIAS(mssql_set_message_handler, sybase_set_message_handler, arginfo_sybase_set_message_handler)

PHP_FALIAS(mssql_deadlock_retry_count, sybase_deadlock_retry_count, arginfo_sybase_deadlock_retry_count)

#endif

*/

如果无需通过mssql.o模块用php访问mssql server则可忽略这一步(用dblib pdo访问不受次影响)

Linux下php访问远程mssq可参考本人的如下博文

Linux下php访问远程ms sqlserver

四、/opt/php/bin/phpize生成编译配置文件 

五、./configure --with-php-config=/opt/php/bin/php-config -with-sybase-ct=/opt/sybase/OCS-16_0

六、make&sudo make install

编译完成在/opt/php/lib/php/extensions/no-debug-zts-20131226/目录下生成sybase_ct.so

七、修改php.ini,将该模块载入: 

extension=sybase_ct.so

八、重启apache服务

sudo service apachectl stop

sudo service apachectl start

九、测试代码

<?php
/* connect to database */
sybase_connect('MYMOTIFVOSTRO145480', 'sa', 'wxwpxh') or
die("Could not connect");
sybase_select_db("testdb");



$result=sybase_query("SELECT * FROM STUDENT");  
while($row=sybase_fetch_array($result))  
{  
   echo $row[0];
   echo '::';
   echo $row[1];
   echo "<br>";   
}  
?>

 

安装sybase时sybase用户主目录为/opt/sybase可正常运行,如为/home/sybase时将/opt/sybase下的文件和目录都软连接到用户主目录下。$ ln -s /opt/sybase/* .

转载于:https://my.oschina.net/u/2245781/blog/625465

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值