{"id":183,"date":"2008-09-12T13:29:05","date_gmt":"2008-09-12T05:29:05","guid":{"rendered":"http:\/\/www.code-life.com\/?p=183"},"modified":"2010-12-02T21:17:40","modified_gmt":"2010-12-02T13:17:40","slug":"%e5%8e%9flinux%e4%b8%8bphp%e6%94%af%e6%8c%81mssqlsql-server","status":"publish","type":"post","link":"https:\/\/www.code-life.com\/?p=183","title":{"rendered":"[\u539f]Linux\u4e0bPHP\u652f\u6301MSSQL(SQL Server)"},"content":{"rendered":"<p>Linux\u4e0b\u4f7fPHP\u652f\u6301MSSQL(SQL Server)\uff0c\u9700\u8981\u5148\u5b89\u88c5FreeTDS\u3002<br \/>\nPHP\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"http:\/\/www.php.net\/\" target=\"_blank\">http:\/\/www.php.net<\/a> \u5f53\u524d\u7248\u672c5.26<br \/>\nFreeTDS\u5b98\u65b9\u7f51\u7ad9\uff1a<a href=\"http:\/\/www.freetds.org\/\" target=\"_blank\">http:\/\/www.freetds.org<\/a> \u5f53\u524d\u7248\u672c0.82<\/p>\n<p><strong>1. \u7f16\u8bd1FreeTDS<br \/>\n<\/strong><br \/>\n\u4e0b\u8f7dFreeTDS\u5e76\u89e3\u538b\uff0c\u8fdb\u5165\u8be5\u76ee\u5f55\u3002<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/freetds<br \/>\nmake<br \/>\nmake install<\/p>\n<p><strong>2. \u7f16\u8bd1PHP<\/strong><\/p>\n<p>\u4f7fPHP\u652f\u6301MSSQL\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e24\u79cd\u65b9\u5f0f\uff0c\u4e00\u79cd\u662f\u76f4\u63a5\u7f16\u8bd1\u8fdbPHP\uff0c\u4e00\u79cd\u662f\u7f16\u8bd1\u6210PHP\u53ef\u8f7d\u5165\u7684\u6a21\u5757\u3002\u5982\u679c\u8fd8\u6ca1\u6709\u7f16\u8bd1\u5b89\u88c5PHP\uff0c\u5efa\u8bae\u4f7f\u7528\u524d\u4e00\u79cd\u65b9\u5f0f\uff0c\u56e0\u4e3a\u8fd9\u6837PHP\u7684\u6267\u884c\u901f\u5ea6\u5feb\u3002\u5982\u679c\u5df2\u7ecf\u5b89\u88c5\u4e86PHP\uff0c\u53c8\u5acc\u91cd\u65b0\u7f16\u8bd1PHP\u9ebb\u70e6\uff0c\u7528\u540e\u4e00\u79cd\u65b9\u5f0f\u5427\u3002<\/p>\n<p><strong>(1) \u7f16\u8bd1\u8fdbPHP<\/strong><\/p>\n<p>\u5982\u4f55\u7f16\u8bd1PHP\uff0c\u8bf7\u53c2\u8003LAMP\u73af\u5883\u914d\u7f6e(<a href=\"http:\/\/www.code-life.com\/?p=185\" target=\"_blank\">http:\/\/www.code-life.com\/?p=185<\/a>)\u3002\u8981\u589e\u52a0\u5bf9MSSQL\u7684\u652f\u6301\uff0c\u53ea\u8981\u5728\u7f16\u8bd1\u53c2\u6570\u4e0a\u52a0\u4e0a&#8211;with-mssql=\/usr\/local\/freetds\u5373\u53ef\u3002<\/p>\n<p><strong>(2) \u7f16\u8bd1\u6210\u6a21\u5757<\/strong><\/p>\n<p>cd \/path\/to\/php\/source \u8fdb\u5165PHP\u6e90\u7801\u76ee\u5f55<br \/>\ncd ext\/mssql \u8fdb\u5165MSSQL\u6a21\u5757\u6e90\u7801\u76ee\u5f55<br \/>\n\/usr\/local\/php\/bin\/phpize \u751f\u6210\u7f16\u8bd1\u914d\u7f6e\u6587\u4ef6<br \/>\n.\/configure &#8211;with-php-config=\/usr\/local\/php\/bin\/php-config &#8211;with-mssql=\/usr\/local\/freetds<br \/>\nmake<br \/>\nmake install<br \/>\n\u7f16\u8bd1\u5b8c\u6210\u751f\u6210mssql.so\uff0c\u4fee\u6539php.ini\uff0c\u5c06\u8be5\u6a21\u5757\u8f7d\u5165\uff1a<br \/>\nextension=&#8221;\/path\/to\/extension\/mssql.so&#8221;<\/p>\n<p><span style=\"color: #ff0000;\">!! IMPORTANT<\/span> \u627e\u4e0d\u5230FreeTDS\u7f16\u8bd1\u5931\u8d25\u7684\u89e3\u51b3<\/p>\n<p>\u5728\u7f16\u8bd1\u914d\u7f6e\u7684\u65f6\u5019\u53ef\u80fd\u4f1a\u9047\u5230\u627e\u4e0d\u5230FreeTDS\u7684\u9519\u8bef\uff1a<br \/>\nconfigure: error: Directory \/usr\/local\/freetds is not a FreeTDS installation directory<br \/>\n\u6309\u7167\u5b98\u65b9\u7684\u89e3\u91ca(<a href=\"http:\/\/www.freetds.org\/news.html\" target=\"_blank\">http:\/\/www.freetds.org\/news.html<\/a>)\uff0cPHP\u68c0\u6d4b\u4e00\u4e9b\u6587\u4ef6\u4ee5\u786e\u5b9aFreeTDS\u662f\u5426\u5b89\u88c5\uff0c\u7531\u4e8e\u65b0\u7248\u7684FreeTDS\u4e0d\u518d\u5b89\u88c5\u8fd9\u4e9b\u6587\u4ef6\uff0c\u5bfc\u81f4PHP\u7f16\u8bd1\u5931\u8d25\u3002\u53ea\u9700\u5efa\u7acb\u4e24\u4e2a\u7a7a\u6587\u4ef6\u5373\u53ef\uff1a<br \/>\ntouch \/usr\/local\/freetds\/include\/tds.h<br \/>\ntouch \/usr\/local\/freetds\/lib\/libtds.a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u4e0b\u4f7fPHP\u652f\u6301MSSQL(SQL Server)\uff0c\u9700\u8981\u5148\u5b89\u88c5FreeT &hellip; <a href=\"https:\/\/www.code-life.com\/?p=183\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9,6,8],"tags":[16,32],"_links":{"self":[{"href":"https:\/\/www.code-life.com\/index.php?rest_route=\/wp\/v2\/posts\/183"}],"collection":[{"href":"https:\/\/www.code-life.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.code-life.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.code-life.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.code-life.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=183"}],"version-history":[{"count":4,"href":"https:\/\/www.code-life.com\/index.php?rest_route=\/wp\/v2\/posts\/183\/revisions"}],"predecessor-version":[{"id":190,"href":"https:\/\/www.code-life.com\/index.php?rest_route=\/wp\/v2\/posts\/183\/revisions\/190"}],"wp:attachment":[{"href":"https:\/\/www.code-life.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.code-life.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.code-life.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}