Do You PHP はてブロ

Do You PHPはてなからはてブロに移動しました

PHP+FreeTDS 0.64でmemory exhausted

LinuxからSQLServerに接続する場合はFreeTDSライブラリが必要になりますが、最新版である0.64を使うと

Allowed memory size of xxxxxxx bytes exhausted 

といったエラーが発生する場合があるようです。直接確認したわけではなく伝え聞きです(^^;が、

  • RHEL4+Apache2.0.52(rpm)+PHP5.2.0(tarball)
  • Windows 2003 Server Standard Edition(SPなし)+SQLServer2000 Standard Edition(SP4)
  • 1レコード取得は問題ないが、複数レコードを取得するときに発生する
  • php.iniのmemory_limitを大きく(1GBとか)しても同様にエラーが発生

といった環境で発生していたようで、以下のblogを参考に1つ前のFreeTDS 0.63に戻すとエラーなく動作しました。
ちなみに、

  • Windows 2000 Professional(SP4)+SQLServer2000 Standard Edition(SP4)

だと、0.64でも動作していたようです。


Version 0.63 is working for me on other servers, so I went back to that, and it is working like a charm. The freetds.conf file in either case is the default installed file.