Take a look at the moodle thread I've linked to in the OP - unfortunately I haven't got any more descriptive error than that (highlighted in Red)
Main Topics
Browse All TopicsHi there I've been trying to setup a moodle website on Windows 2008 with IIS7 for several weeks now and it's very difficult, but I'm quite close..
I've posted on the moodle forums but these aren't monitored very much and I'm a bit noob at php http://moodle.org/mod/foru
Our problem at the moment (hopefully last one) is with the application connecting to the database. I've tried using both mysql and mssql but I get errors with both.
Is there some simple was I can test what the problem may be?
Can we use another simpler php program to test database connection?
I don't have any freetds.config file or the option for it's DLL in php.ini
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
for windows 2008 and iis 7 you can use the web platform installer
http://www.microsoft.com/w
with this tool you can setup your server (iis, php, sqlserver) and you can also install a number of web aplications (including moodle) with just a few clicks.
If you want to test create a file called test.php (or something), add the code below and upload to your server. That should help you nail down what the settings should be.
Easy Hosting Solutions
http://www.HDWebStudios.co
mssql_error() is not valid. FYI. Change that to something like $conn = mssql_connect(DBSERVER,DBU
Doesn't give you the SQL error but you only have a few variables to work with, if you cannot get this to work you may have other problems. Look at this page:
http://www.helpspot.com/he
Yeap we got other wtf issues..
We don't have the ntwdblib.dll file in PHP ext or even commented in php.ini
If fact these are the only extensions in the ext directory:
php_curl.dll
php_exif.dll
php_gd2.dll
php_gettext.dll
php_imap.dll
php_mbstring.dll
php_mssql.dll
php_mysql.dll
php_mysqli.dll
php_openssl.dll
php_pdo.dll
php_pdo_mysql.dll
php_pdo_sqlite.dll
php_soap.dll
php_tidy.dll
php_wincache.dll
php_xmlrpc.dll
php_zip.dll
Yes it's enabled in php.ini
I've tried the test.php connection for mysql (I don't mind it running with either DB at this stage)
I get this error:
Can't open name pipe to host: . pipe: MySQL (2)
What does the (2) mean - could we have two instances of mysql installed and it's getting confused between them? If so how can I confirm / remove them.. There is only one mysql service..
Did you enable TCP/IP networking? Look here: http://dev.mysql.com/doc/m
Add the port to DBSERVER, see below.
Easy Hosting Solutions
http://www.HDWebStudios.co
I am told I may need to setup freeTDS to get the database connection working..
I've downloaded a Non-Thread Safe DLL for php5.2 from moodle.org and added it to the \php\ext folder
I added this line to php.ini under [mysql]
extension=php_dblib.dll
created freetds.conf file in c:\ with the following content
[global]
host = 192.serverIP..
port = 3308
client charset = UTF-8
tds version = 8.0
text size = 20971520
Is this required and if so am I on the right track here?
This should not be needed unless it is a Plesk thing. I mean I have this working on a Windows 2008 server here and it just wasn't this difficult. I am using the standard port, but still doesn't seem to be your problem. I would start looking at everything I guess. Can you pull a phpinfo page? I'm sure you already know this but make a page something.php and put <?PHP phpinfo(); ?> in the file. Upload and run, do you get the page?
OK I've decided to start again from scratch using the exact same config as the moodlewindows.za.net guide (win2k3 server, iis6, sql2005, non thread sage php 5.2 fastcgi, freetds) and have followed everything in there exactly, however now we are still getting Error: Database connection failed.
In the phpinfo.php page now there is no database section at all..
I have tried setting up error_log = syslog in php.ini but there are now events written to event log..
Any simple suggestions how I might enable the database section of phpinfo.php and get around this error?
Ok. Sounds like you are using MSSQL then. Run the PHP install executable, select "Change", drill down and find the MSSQL extension. Install it. When you are done, download the attached file, rename .txt to .dll, find it on your system, and replace it with this one (trust me MSSQL will never work if you do not, Google it if you want). Restart w3svc and rerun phpinfo, make sure it shows up now. Re-test.
Easy Hosting Solutions
http://www.HDWebStudios.co
I was following the moodlewindows guide which recommends using freetds over the mssql.dll connection because of a Unicode problem / difference..
I have got this running now and the MSSQL section appears in phpinfo.php now so it seems the only problem is the connection to database.. I'm going to delete the DB and user and create them again and see how I go..
Is there another way to test this with error logging other than the $conn = mysql_connect method as above?
This is currently just giving the wtf message
OK I found the problem - The freetds wasn't loading with this:
extension=php_dblib.dll
I added that also this into php.ini
error_log=syslog
That showed an error in Event Log: 18488
Login failed for user 'UserLogin'. Reason: The password of the account must be changed
I resolved it with:
ALTER LOGIN UserLogin WITH PASSWORD = 'NewPassword' UNLOCK
I then set the password and turned of 'enforce password policy' and could connect to database :)
Thanks for the advice guys - grreat to get it going at last!
Business Accounts
Answer for Membership
by: TiberiuGalPosted on 2009-11-05 at 12:25:21ID: 25753566
Hi,
Please give us the error messages you receive - both for MySQL and SQL Server.
We also need the php code you use when trying to connect.