Can't connect to external Server


Recommended Posts

Hello, I'm building some forms in PHP and I'm deploying them in Server #1, the MSSQL DB is in Server #2, I've written this code to access the DB

 

<?PHP
$username ="yyy";
$password = "xxx";
$database = "fff";
$server = "111.222.333.444,1433";

$connection = mssql_connect($server, $username, $password);
echo "Connected!3";
if (!$connection) {  
    die('Not connected : ' . mssql_get_last_message());
}
echo "Connected!5";
if ($connection) {  
    echo "Connected!1";
}
echo "Connected!2";
?>

 

The result is a blank page, after the $connection, nothing shows, not even the echos.

 

The Administrator told me that the info that he provided, "thinks" it's correct.

 

How can I check if the info that he provided is correct?

 

I've access to both Servers.

 

The problem is really in the info provided or it's another problem?

Link to comment
Share on other sites

This isn’t really a windows server issue, this is a programming issue.  I have moved your previous query to the programming section to see if anyone monitoring that has any insight for you. But understand, this is not a native windows server function or problem. 

Link to comment
Share on other sites

Well, if the code is correct (has seen in php.net), the problem must be with the connection to the server, some setting or something in the server that it needs to be in the code, so, I don't think it should be in the section of coding.

 

But, anyway, you surely know more about this than me, thanks anyway.

 

 

Link to comment
Share on other sites

If you have access to both servers, you could disable the software firewall and try again.

 

If it still is failing, you could try running wireshark on the remote server and see if there are any connections being made to the server from the other server.  If you are getting a connection, it is more than likely a code issue.  Communications are pretty straight forward...if it is a firewall issue you can start to troubleshoot by turning off the firewall, then it becomes a larger issue with determining the correct ports to open in the firewall after you re-enable it. 

 

Thinking it is right isn't the same as knowing it is right.

Link to comment
Share on other sites

If you're getting a blank page, that suggests an error is being thrown, and display_errors is turned off in your php.ini file. Start by looking at the php error log, or turning on display_errors (turn it off again before you go into production!) so you can see what's going on. My guess is that you don't have the mssql extension loaded.

Link to comment
Share on other sites

On 5/9/2018 at 8:58 AM, DaveLegg said:

If you're getting a blank page, that suggests an error is being thrown, and display_errors is turned off in your php.ini file. Start by looking at the php error log, or turning on display_errors (turn it off again before you go into production!) so you can see what's going on. My guess is that you don't have the mssql extension loaded.

Thanks, I'm getting there. What I did:

1 - Turned on display_errors in php.ini file (to see the error)

2 - Installed the mssql extension

 

Now I'm redoing the code, since

mssql_connect()

Doesn't work anymore in v7+

 

Thanks!

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.