PHP MSSQL Nightmare

PHP MSSQL Nightmare

by Ed Russell -
Number of replies: 3

As with many, many people on this forum, I am having difficulty getting PHP to play nice with MSSQL (and no, MySQL is not an option for me). I've created the empty Moodle database and I've verified it can be accessed via the prescribed SQL MoodleUser account. So now I have a couple of questions regarding the "Installing MSSQL for PHP" document.

1. I'm running on Window 2003 with IIS (and no, Apache is not an option for me either). Many of the forum replies seem to inidcate that FreeTDS is only necessary for Unix/Linux installs. Must I use FreeTDS or ODBTP in order to get this to work on Windows/IIS?

2. I'd like to take the Moodle install out of the PHP/MSSQL equation. Is there an easy way to test the  PHP/MSSQL connection outside of the Moodle install?

3. I also see on several of the replies to this problem that people have found multiple PHP.INI files and they were editing the wrong one, or that they copied the PHP.INI file to one of the Windows directories. Can anyone shed any light on that? And which windows directory should I be looking at to copy the file to?

4. The FreeTDS instuctions say to create a freetds.conf file in the root directory of the C: drive. Is that a typo? And if not, why does it look for the file there?

I know this is a lot of questions, but any help is much appreciated.

Thanks in advance,

Ed

Average of ratings: -
In reply to Ed Russell

Re: PHP MSSQL Nightmare

by Ed Russell -

I finally got it all working. Here are the answers to my questions in case the information might help someone. I also created a detailed post of my solution here: http://moodle.org/mod/forum/discuss.php?d=86769

1. Yes you need a driver/extension. I ended up useing FreeTDS exactly as prescribed. ODBC and the new MS driver are not yet officially sanctioned. (See solution post above.)

2. The best way to debug is to enable display errors. (see solution post above.)

3. The latest PHP installer for Windows has PHP looking for the php.ini file in the C:\Windows directory, but it creates and modifies it in the PHP install directory. (See solution post above.)

4. Yes, the freetds.conf goes in the C:\ root directory.

Ed