Talk:Installing MSSQL for PHP
Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Installing MSSQL for PHP.
Are the ODBTP instructions for ODBTP.conf incorrect? According to moodle forum, 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. It is arguable if FreeTDS has any real impact on MSSQL anyway. This only serves to confuse the issue so anyone needing the information in this page is going to find it hard to follow. --Colin Fraser 14:59, 23 January 2010 (UTC)
- Sorry but I'm not sure that moving the "FreeTDS for Unix" section to a new page is a good idea at all. Firstly, it used to be 100% in pair with the "FreeTDS for Windows" documentation (in same page) and also, there are a bunch of links out there to the section that, right now, will be failing completely.
- The justification of "seems to be a couple of almost completely unrelated items here on this page, one about Using FreeTDS on Unix..." sounds wrong IMO. This page documents how to run Moodle against one MSSQL server, and it must cover all the alternatives (different drivers, different web servers...). I could see the point about moving all sections to new pages, but not only the "FreeTDS for Unix". Unpretty unbalanced IMO. So +1 to revert that. --Eloy Lafuente (stronk7) 13:17, 27 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.
Using FreeTDS on Windows
peter peter added a comment saying that "Do not try FREETDS environment variable - does not work!!!" Peter, can you explain what "does not work" means? Have you tried setting that FREETDS environment variable? Saying that something "doesn't work" without backing it up with facts isn't very helpful. Please provide more details.
- Hi Luis, FYI, follow-up for this at MDL-22556 (feel free to ask Peter there) --Eloy Lafuente (stronk7) 07:54, 2 June 2010 (UTC)
- Eloy (and Peter), I think I've shown that the FREETDS environment variable actually DOES work (on PHP 5.2 at least) - see my comments in MDL-22556 for details. And Peter is in agreement. But if we can show that it doesn't work in PHP 5.3 then we can update this Installing MSSQL for PHP page with a message specifically for 5.3 (after we've determined why it doesn't work in 5.3). --Luis de Vasconcelos 13:06, 2 June 2010 (UTC)
- Luis (Peter), thanks for finding the ultimate cause for Peter's problems. I was 100% sure it should be something on his installation. Thanks for fixing Docs too. Ciao :-) --Eloy Lafuente (stronk7) 13:45, 2 June 2010 (UTC)