We took a copy of our Ubuntu virtual server and changed its name and IP. In every other way it is a duplicate of our production server. Now for some reason we can't get php connection to SQL-SERVER. So I was hoping someone here could help me out what to do next.

Thanks for your help!


MSSQL Support   enabled
Active Persistent Links     0
Active Links    0
Library version     FreeTDS

Directive   Local Value Master Value
mssql.allow_persistent  On  On
mssql.batchsize 0   0
mssql.charset   no value    no value
mssql.compatability_mode    Off Off
mssql.connect_timeout   5   5
mssql.datetimeconvert   On  On
mssql.max_links Unlimited   Unlimited
mssql.max_persistent    Unlimited   Unlimited
mssql.max_procs Unlimited   Unlimited
mssql.min_error_severity    10  10
mssql.min_message_severity  10  10
mssql.secure_connection Off Off
mssql.textlimit Server default  Server default
mssql.textsize  Server default  Server default
mssql.timeout   60  60

Connector gives me nothing but "MSSQL error:"

    $dbhandle = mssql_connect($myServer, $myUser, $myPass)
    if (!$dbhandle) {

die('Something went wrong while connecting to MSSQL');

NOTE! I do not get any error nro or msg on the die command

UPDATE: Also tried this, but no help SQLSTATE[HY000] Unknown host machine name (severity 2)

UPDATE 2: -Reinstalled according to https://zxtech.wordpress.com/tag/how-to-connect-to-sql-server-from-ubuntu/ -Ping: OK -Telnet: OK -Still no error msg on php scripts

UPDATE 3 Found the problem: Server name is not working. As I have connected on sqlservename.sql.something now I have to connect with the straight up ip 123.4567.890.12

  • Did you change the value for your $myServer variable when you migrated the server? – douggro Feb 19 '15 at 15:35
  • We changed it to apache-sites-enabled script after migration – user1054844 Feb 20 '15 at 8:00
  • since we do not have enough information to analyse it, I guess: Your test machine cannot connect to mssql server, because of a firewall? Maybe you are using an mssql srver with only one allowed connection at a time (I really do not know nor care under what conditions you are allowed to use m$ precious databaseserver)? – mondjunge Feb 20 '15 at 9:00
  • Firewall rules have been dublicated to allow the copied server, and it allows multiple connections. No need to be hostile @mondjunge I´am only trying to ask where to look next – user1054844 Feb 20 '15 at 9:29
  • Also if it was that firewall is blocking the connection there should be "Connection refused" given as error – user1054844 Feb 20 '15 at 9:30

Finally we found out the reason: The problem was that on migration the file containing our DNS-SERVERS was overwritten by Wmvare. Meaning that even though the servers were duplicates the IP for our DNS-servers was changed..

We had no reason to suspect this as it should have been full copy of functioning server

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.