• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

Sign in to follow this  

Can't connect to external Server

Recommended Posts

Pedro3    5

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?

Share this post


Link to post
Share on other sites
sc302    1,684

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. 

Share this post


Link to post
Share on other sites
Pedro3    5

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.

 

 

Share this post


Link to post
Share on other sites
sc302    1,684

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.

Share this post


Link to post
Share on other sites
DaveLegg    974

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 1

Share this post


Link to post
Share on other sites
Pedro3    5
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.