[freetds] [Fwd: Problems configuring php with freetds]

Daniel Fazekas fdsubs at t-online.hu
Fri Jun 6 15:34:16 EDT 2008


On Jun 6, 2008, at 21:13, Michael Soh wrote:

>> Try to run you PHP script from the command line, rather than the  
>> web environment, and you'll probably see that the database  
>> connection is allowed there.
> I tried this but got the same result.

That's actually very helpful that you could reproduce the problem from  
the command line. It's a lot easier to experiment and debug it there  
with the web server out of the way.

> I tried enabling logging per the instructions on the web site.  For  
> some reason, logging isn't happening.

 From the command line, you could try something like this:
TDSDUMPCONFIG=stdout TDSDUMP=stdout php /your/script/here.php

Then you should see a bunch of FreeTDS debug output dumped straight to  
your terminal.
If you don't get anything, then somehow PHP is not even calling the  
FreeTDS code.

> Could it be that I compiled freetds and/or php incorrectly?  Is  
> there a way to check?

You could also check if the PHP mssql extension is linked to the  
FreeTDS libraries.

If you built the PHP mssql extension as shared:

$ php -i | grep extension_dir
extension_dir => /usr/local/lib/php/extensions/no-debug-non-zts-20020429

$ ldd /usr/local/lib/php/extensions/no-debug-non-zts-20020429/mssql.so

the output should have FreeTDS's libdb in there.

Or if you liked the PHP mssql extension in statically, check the php  
binary itself:

$ ldd $(command -V php)




More information about the FreeTDS mailing list