Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Installing MSSQL for PHP.

Talk:Installing MSSQL for PHP: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 13: Line 13:
:Hi Richard, I think it was a "visual" thing, where backslashes in italic text was looking like vertical bars (that's the cause your copy & paste worked ok, because they were correct backslashes). I've changed the italics to bold in the page to avoid any confusion. Thanks! --[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 21:59, 22 March 2009 (UTC)
:Hi Richard, I think it was a "visual" thing, where backslashes in italic text was looking like vertical bars (that's the cause your copy & paste worked ok, because they were correct backslashes). I've changed the italics to bold in the page to avoid any confusion. Thanks! --[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 21:59, 22 March 2009 (UTC)


There seems to be a couple of almost completely unrelated items here on this page, one about Using FreeTDS on Unix and the other Using ODBTC in Windows or Linux. While the title of the page relates to MSSQL, a lot of the page brings in foreign detail. This only serves to confuse the issue. --[[User:Colin Fraser|Colin Fraser]] 14:59, 23 January 2010 (UTC)
There seems to be a couple of almost completely unrelated items here on this page, one about Using FreeTDS on Unix and the other Using ODBTP in Windows or Linux. While the title of the page relates to MSSQL, a lot of the page brings in foreign detail. This only serves to confuse the issue. --[[User:Colin Fraser|Colin Fraser]] 14:59, 23 January 2010 (UTC)





Revision as of 15:00, 23 January 2010

Are the ODBTP instructions for ODBTP.conf incorrect? According to moodle forum[1], the ODBTP.conf must point to the host of the ODBTP service, not the MSSQL server.

I can only verify this for Windows, no idea about unix.

Hi Ben, I've updated the documentation. All my tests were/are with both the ODBTP service + the MSSQL server in the same host so I never had that problem. Thanks for pointing to it! Eloy Lafuente (stronk7) 09:50, 16 July 2007 (CDT)

Also, unlike the other methods described in this article, we are not given a clue as to what to put for the $CFG->db... parameters in config.php, especially $CFG->dbtype. --Richard Enison 07:45, 9 June 2008 (CDT)

Hi Richard, the correct parameter for proper MSSQL-UTF8 connections is: $CFG->dbtype = 'mssql_n', going to insert that somewhere in the page. Thanks! Eloy Lafuente (stronk7) 12:40, 19 June 2008 (CDT)

And I presume that the statement in the ODBTP section that reads: (where /path/to/your/odbtp.conf" is usually "/usr/local/etc/odbtp.conf"" for Unix systems and "C:|odbtp|odbtp.conf" for Windows systems) should look like (where "/path/to/your/odbtp.conf" is usually "/usr/local/etc/odbtp.conf" for Unix systems and "C:\odbtp\odbtp.conf" for Windows systems). When I copied it from the article and pasted it here, the vertical bars turned into backslashes, so I replaced them with vertical bars to show what it really looks like. Richard Enison 11:39, 22 March 2009 (UTC)

Hi Richard, I think it was a "visual" thing, where backslashes in italic text was looking like vertical bars (that's the cause your copy & paste worked ok, because they were correct backslashes). I've changed the italics to bold in the page to avoid any confusion. Thanks! --Eloy Lafuente (stronk7) 21:59, 22 March 2009 (UTC)

There seems to be a couple of almost completely unrelated items here on this page, one about Using FreeTDS on Unix and the other Using ODBTP in Windows or Linux. While the title of the page relates to MSSQL, a lot of the page brings in foreign detail. This only serves to confuse the issue. --Colin Fraser 14:59, 23 January 2010 (UTC)


php_dblib.dll not loading

Thanks for a fantastic step-by-step post. I'm positive I've got the big stuff covered. I'm just down to this.

I've got php_dblib.dll in the ext directory ... .NET Framework 1.1 ... c:\freetds.conf, etc.

But I get this error: Call to undefined function mssql_connect()

If I change php.ini to load php_mssql.dll it works. If I switch it to load php_dblib.dll, it just doesn't seem to find it. I changed file perms to everyone/full control on almost everything.

If I turn on startup errors, I get a timeout, even when changing script execution to 600 seconds...so I can't debug it further.

Any thoughts on what I'm doing wrong? It has to be something incredibly minor.

Hi Christopher, in first term I'd try to take a look to the output of phpinfo();, in the mssql section, to see if the driver (and which one) has been really loaded. Also, it would be great to know a bit more about what OS/PHP/DBLIB versions are being used in your site. The error "Call to undefined function" seems to indicate that the driver hasn't been loaded, for any reason, hence connection fails. But I cannot say too much else. Current drivers are supposed to work under any Win32 flavour and PHP 5.2. Ciao, Eloy Lafuente (stronk7) 17:44, 5 May 2009 (UTC)

Wow thanks for the quick reply! Oddly enough I don't see an mssql section on the phpinfo() output. Tons of other stuff, but not that one.

This is running on Windows Server Standard 2003, PHP 5.2.9-2 (from the Web Platform Installer), and used the php_dblib.dll from your article. I think it's 0.82?

A little info if any of this helps from phpinfo()

Server API CGI/FastCGI Configuration File (php.ini) Path C:\WINDOWS Loaded Configuration File C:\Program Files\PHP\php.ini PHP API 20041225

I've also even tried for kicks to swap filesnames between the two dll's (mssql and dblib) and leave the php.ini intact, just bouncing the web services after each change. It works every time when using the real mssql.dll and never when using the dblib.dll. My guess is it's some kind of dependency. I've double checked that I have .NET Framework 1.1.

And that CGI/FastCGI configuration... does it require the thread safe or the non thread safe version of the library? (note I'm not a Windows expert at all). Also, if you enable startup errors in php.ini file... while having the dblib extension installed and enabled... then you should be able to see errors somewhere (not sure where Windows uses to log them). That uses to give some info about what's missing and so on. Perhaps, running php (the executable) from command prompt will show you that info. In any case, if you don't see the mssql extension loaded (and saying something like "Version: FreeTDS") in the phpinfo() output, then, for sure, it isn't being loaded. Try to enable all logs at their maximums to see if you can get some more info. Really I cannot imagine too much else... --Eloy Lafuente (stronk7) 20:25, 5 May 2009 (UTC)
Trivial thing, I hope you've restarted the web server services after changing the libraries, yes? At least it uses to be needed in Apache. :-) --Eloy Lafuente (stronk7) 20:27, 5 May 2009 (UTC)

Thanks again. I now see the error "php5ts.dll was not found." when running php-cgi.exe from the command prompt. I don't even have that .dll on this machine. Do you recognise this .dll?

While I'm not sure that I did the right thing, I found php5ts.dll and downloaded it. Now it all works! Thanks for your help.

SQL Server 2005 & FreeTDS

Just thought someone out there might like to know - the dreaded Unicode error occurs when using FreeTDS with SQL Server 2005 SP1, even when you following the given directions to the letter. However, everything works fine with SQL Server 2005 SP2.