[freetds] Re: PHP & FreeTDS

Daniel Fazekas fdsubs at axelero.hu
Sat Aug 14 20:43:57 EDT 2004

On Aug 15, 2004, at 2:20, Petar Djekic wrote:

> and PHP using './configure --mssql=/usr/local/freetds --mysql=/usr
> --with-apxs2=/etc/httpd/bin/apxs' and few others..
> both complied fine and PHP says its got mssql support in the
> phpinfo()..

Then your PHP configure line must have read --with-mssql as --mssql 
wouldn't have worked.

> now when i run an php script just containing '<?php $sql =
> mssql_connect(server, user, pass) ?>' i get an 'Zero Sized Reply'

That sounds like php segfaulting your apache child process.
There's probably a line saying "Segmentation fault" in your apache 
error_log file.

A common mistake is trying to use a host name or IP address as the 
server parameter for mssql_connect, while it should be a freetds.conf 
server entry's name. Still, that wouldn't cause a segfault.

I'd check your script with the cli (command line) php interpreter first 
of all to eliminate Apache until you figure out your problem.

Make sure you are running a recent version of both FreeTDS and PHP, 
especially if it's your Mac you are trying to make it work on.

> Also, how can i run any SQL queries in tsql?

Last time I checked, you could simply type them in. :) Or am I 
confusing it with something?
James' recent bsqldb tool or sqsh (a separate project) are also great 
for testing.

When you are using the mssql extension in PHP, you are using FreeTDS' 
dblib, same as bsqldb.


More information about the FreeTDS mailing list