Skip to Content.
Sympa Menu

freetds - RE: [freetds] Re: connecting to remote MS Sql 2k server from linux PHP

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Re: connecting to remote MS Sql 2k server from linux PHP
  • Date: Tue, 2 Nov 2004 14:20:28 +0100

>
> Ok, I'm kind of at the end of my patience here... Is there
> anyone out there
> that would set this up for either free or for a fee?
>

Try this script

<?php
error_reporting(E_ALL);

$service_port = 1433;
$address = gethostbyname('66.208.184.170');

echo "<h2>TCP/IP Connection</h2>\n";

$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0) {
echo "socket_create() failed: reason: " . socket_strerror($socket) .
"<br>";
exit(1);
} else {
echo "OK.<br>";
}

echo "Trying to connect to '$address' on port '$service_port'...";
$result = socket_connect($socket, $address, $service_port);
if ($result < 0) {
echo "socket_connect() failed. reason: ($result) " .
socket_strerror($result) . "<br>";
exit(1);
} else {
echo "OK.<br>";
}

echo "Closing socket...";
socket_close($socket);
echo "OK.<br>";
?>

It should return a page with

TCP/IP Connection
OK.
OK.
OK.

An error means connection problems

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page