<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[张宴的博客]]></title> 
<link>http://zyan.cc/index.php</link> 
<description><![CDATA[Web系统架构与底层研发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[张宴的博客]]></copyright>
<item>
<link>http://zyan.cc/php_sqlserver_freetds/</link>
<title><![CDATA[Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[PHP/JS/Shell]]></category>
<pubDate>Fri, 25 Jun 2010 10:00:35 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/</guid> 
<description>
<![CDATA[ 
	　　CentOS 5.4 Linux 下的 PHP（FastCGI） 需要连接相关部门的SQL Server 2000数据库，配置了扩展FreeTDS扩展。<br/><br/>　　<strong>1、编译安装FreeTDS</strong><br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">mkdir -p /data0/software/<br/>cd /data0/software/<br/>wget <a href="ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz" target="_blank">ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz</a><br/>tar zxvf freetds-stable.tgz<br/>cd freetds-0.82/<br/>./configure --prefix=/usr/local/webserver/freetds --with-tdsver=8.0 --enable-msdblib<br/>make && make install<br/>cd ../<br/> <br/>echo "/usr/local/webserver/freetds/lib/" > /etc/ld.so.conf.d/freetds.conf<br/>ln -s /usr/local/webserver/freetds/lib/libsybdb.so.5.0.0 /usr/local/webserver/freetds/lib/libsybdb.so.4<br/>/sbin/ldconfig<br/><br/>rm -f /usr/local/webserver/freetds/etc/freetds.conf<br/>vi /usr/local/webserver/freetds/etc/freetds.conf</div><br/>　　输入以下内容：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">[global]<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# TDS protocol version<br/>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tds version = 4.2<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Whether to write a TDSDUMP file for diagnostic purposes<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# (setting this to /tmp is insecure on a multi-user system)<br/>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dump file = /tmp/freetds.log<br/>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; debug flags = 0xffff<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Command and connection timeouts<br/>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timeout = 10<br/>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connect timeout = 10<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# If you get out-of-memory errors, it may mean that your client<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# is trying to allocate a huge buffer for a TEXT field.<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# Try setting 'text size' to a more reasonable limit<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text size = 64512<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;host = mssql.yourdomain.com<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;port = 1433<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tds version = 8.0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;client charset = UTF-8</div></div><br/><br/>　　<strong>2、编译安装PHP自带MSSQL扩展</strong><br/>　　进入本地已存在的php-5.2.XX源码包目录：<br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">cd /data0/software/php-5.2.XX/ext/mssql/<br/>/usr/local/webserver/php/bin/phpize<br/>./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-mssql=/usr/local/webserver/freetds/<br/>make && make install</div><br/><br/>　　<strong>3、在php.ini配置文件中增加mssql.so</strong><br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">vi /usr/local/webserver/php/etc/php.ini</div><br/>　　增加一行：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">extension = "mssql.so"</div></div><br/><br/>　　<strong>4、重启PHP FastCGI</strong><br/><div style="border-left: 0px dashed #D6C094; margin: 5px; padding: 3px; margin-bottom:0px; border: 1px dashed #00a0c6; background-color: #ffffff;">/usr/local/webserver/php/sbin/php-fpm restart</div><br/><br/>　　<strong>5、测试文件（test_mssql.php）：</strong><br/><textarea name="code" class="php" rows="15" cols="100"><?php
header("Content-type: text/html; charset=utf-8");
$msdb=mssql_connect("mssql.yourdomain.com:1433","username","password");
if (!$msdb) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo "connect sqlserver error";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;
&#125;
mssql_select_db("database_name",$msdb);
$result = mssql_query("SELECT top 5 * FROM table", $msdb);
while($row = mssql_fetch_array($result)) &#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var_dump($row);
&#125;
mssql_free_result($result);
?></textarea><br/>Tags - <a href="http://zyan.cc/tags/php/" rel="tag">php</a> , <a href="http://zyan.cc/tags/centos/" rel="tag">centos</a> , <a href="http://zyan.cc/tags/linux/" rel="tag">linux</a> , <a href="http://zyan.cc/tags/freetds/" rel="tag">freetds</a> , <a href="http://zyan.cc/tags/sqlserver/" rel="tag">sqlserver</a> , <a href="http://zyan.cc/tags/mssql/" rel="tag">mssql</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6231</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>kindle &lt;kindle@live.cn&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 25 Jun 2010 12:01:07 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6231</guid> 
<description>
<![CDATA[ 
	占座来的
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6232</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>jawa &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 25 Jun 2010 12:23:18 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6232</guid> 
<description>
<![CDATA[ 
	相关部门。。
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6233</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>mark &lt;markanna1394@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 25 Jun 2010 12:29:58 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6233</guid> 
<description>
<![CDATA[ 
	期待你新的文章。好久沒更新了
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6234</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>mark &lt;markanna1394@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 25 Jun 2010 12:31:30 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6234</guid> 
<description>
<![CDATA[ 
	期待你新的文章，好久沒更新了，
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6236</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>Poison &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 25 Jun 2010 12:51:31 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6236</guid> 
<description>
<![CDATA[ 
	神秘的相关部门
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6238</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>爱月 &lt;aimoon16@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 25 Jun 2010 16:49:11 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6238</guid> 
<description>
<![CDATA[ 
	有新文章必须要批阅一下～<br/>已阅～已收藏～待仔细阅读中～
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6239</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>axengine &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 26 Jun 2010 06:00:42 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6239</guid> 
<description>
<![CDATA[ 
	你们有多少太测试机哦？
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6240</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>吕滔 &lt;admin@lvtao.net&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 26 Jun 2010 06:30:57 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6240</guid> 
<description>
<![CDATA[ 
	大哥，我又来了。。<br/>哈哈。。学习着。。
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6241</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>sapling &lt;crdd1130@gmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 26 Jun 2010 07:04:29 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6241</guid> 
<description>
<![CDATA[ 
	相关部门的SQL Server 2000是重点。呵呵。
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6247</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>ring &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sun, 27 Jun 2010 12:50:10 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6247</guid> 
<description>
<![CDATA[ 
	这种文章都放出来，质量越来越差了。
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6250</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>阿辉 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 28 Jun 2010 09:42:02 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6250</guid> 
<description>
<![CDATA[ 
	php + sql server 高峰时会有连不上的问题，不知道你碰到过没？<br/><br/><a href="http://hi.baidu.com/farmerluo/blog/item/aba35c6021b524d58db10ddd.html" target="_blank">http://hi.baidu.com/farmerluo/blog/item/aba35c6021b524d58db10ddd.html</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6251</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>陈文栋 &lt;chenwendong@kingsoft.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 28 Jun 2010 10:22:52 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6251</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6271</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>冷柜 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jul 2010 02:42:49 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6271</guid> 
<description>
<![CDATA[ 
	<a href="http://www.lenggui.info" target="_blank">冷柜</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6275</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>shark巨菜 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 02 Jul 2010 01:59:35 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6275</guid> 
<description>
<![CDATA[ 
	这个我之前也做过，sql05 sql08其实也不差。主要是我除了装都不会，上次还被刷下来了。不过我会继续努力的。
]]>
</description>
</item><item>
<link>http://zyan.cc/php_sqlserver_freetds/#blogcomment6282</link>
<title><![CDATA[[评论] Linux 下 PHP 5.2.x 连接 SQL Server 数据库 FreeTDS 配置笔记]]></title> 
<author>侬本多情 &lt;shine@bld.cc&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sat, 03 Jul 2010 02:20:40 +0000</pubDate> 
<guid>http://zyan.cc/php_sqlserver_freetds/#blogcomment6282</guid> 
<description>
<![CDATA[ 
	技术牛人哦..
]]>
</description>
</item>
</channel>
</rss>