Page 1 of 1
mssql_connect pulling my hair out....please please help
Posted: Tue Jun 17, 2008 6:28 am
by hairytea
I want to get a connection to a remote host....
I have been supplied...
Server IP Address
username
password
port number
database name
from looking throught the php.net i am more confused lol...a lot of posts mention the php_dblib.dll or php_mssql.dll files missing?
What does this mean? does it mean i need to contact the webhost where the script is running from and tell them to add these file to the php.ini?
Anyway, my script is as follows...
Code: Select all
<?php
$myServer = "xx.xxx.xx.xxx:1433";
$myUser = "xxx";
$myPass = "xxxx";
$myDB = "xxxxxx";
// connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
// select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
echo "You are connected to the " . $myDB . " database on the " . $myServer . ".";
// close the connection
mssql_close($dbhandle);
?>
ANY IDEAS?
Re: mssql_connect pulling my hair out....please please help
Posted: Tue Jun 17, 2008 6:37 am
by madan koshti
you need to make sure that extension=php_mssql is insalled on your php system.By default "extension=php_mssql.dll" is kept off.you need to uncomment that lineinphp.ini.
Re: mssql_connect pulling my hair out....please please help
Posted: Tue Jun 17, 2008 6:41 am
by onion2k
What's the problem? What error message are you getting?
Re: mssql_connect pulling my hair out....please please help
Posted: Tue Jun 17, 2008 6:52 am
by hairytea
madan koshti wrote:you need to make sure that extension=php_mssql is insalled on your php system.By default "extension=php_mssql.dll" is kept off.you need to uncomment that lineinphp.ini.
Hi,
would i need to change my system parameters even though I am trying to connect fromt the website and not from my local system?
Many thanks
Andrew
Re: mssql_connect pulling my hair out....please please help
Posted: Tue Jun 17, 2008 6:54 am
by hairytea
onion2k wrote:What's the problem? What error message are you getting?
I am getting the following....
Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: xx.xxx.xx.xxx:1433 in e:\domains\i\XXXXXX\user\htdocs\mysqlConnection.php on line 15
Couldn't connect to SQL Server on xx.xxx.xx.xxx:1433
Re: mssql_connect pulling my hair out....please please help
Posted: Tue Jun 17, 2008 7:09 am
by onion2k
The code is working fine then, the problem is either that your server is configured to block outgoing connections, or the Mssql server is configured to block incoming connections. Neither of which can be fixed by talking about it here. You'll have to talk to whoever controls the servers/networks you're using.
Re: mssql_connect pulling my hair out....please please help
Posted: Tue Jun 17, 2008 7:13 am
by hairytea
onion2k wrote:The code is working fine then, the problem is either that your server is configured to block outgoing connections, or the Mssql server is configured to block incoming connections. Neither of which can be fixed by talking about it here. You'll have to talk to whoever controls the servers/networks you're using.
I'm glad you said that... have over 25 emails (from today only) to the IT guys responsible for this server and they keep repeating the same....
IT - This is a Microsoft Server NOT a MySql server and your code is incorrect for making connection you need to write VB script???
ME - I'm sure the server is just rejecting traffic from the website, please investigate.
IT - No, it's not the problem.
SEE WHY I'M PULLING MY HAIR OUT????
AAAAAAAAAAAARRRRRGGGGGGHHHHHHHHHH

Re: mssql_connect pulling my hair out....please please help
Posted: Tue Jun 17, 2008 8:37 am
by onion2k
Well, you have called your script "mysqlConnection.php", so I can kind of see their point... The error message shows you're using the right function for mssql though.
Ask them if they can tell you what the VBscript for a remote connection should be. If you can get that working, by opening up whatever links/ports need to be open on the network, then PHP should work too.