I have a php/pear script that connects to different (one local and one remote) databases etc.
When I call this script from web browser all works fine. It connects to a local and remote database without any problems.
When i call this script from Windows CLI
Code: Select all
:loop
C:\PHP\php.exe -f "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\MG\recording_fjas.php"
ping -n 500 127.0.0.1>nul
goto loopThe function to connect to the DB
Code: Select all
function piesl_datubaazei($db_type, $user, $pass, $address, $database)
{
require_once("DB.php");
$dsn = $db_type.'://'.$user.':'.$pass.'@'.$address.'/'.$database ;
$db =& DB::Connect( $dsn, array( ) );
if (PEAR::isError($db))
{
$text = $subject_name.' ITEM DB kluda'."\n".$db_type.'://'.$user.'@'.$address.'/'.$database."\n".$db->getMessage();
die($db->getMessage( ));
}
return $db;
}Using wireshark i have captured, that, when calling from web browser, it starts the communication with a SYN -> SYN, ACK -> ACK and then starts sending Tabular data stream (TDS) as it should, but when calling from CLI it tries to send SYN messages to microsoft-ds (TCP port 445), only then it starts to talk on 1433 (SQL) port -> sends ACK to the remote server -> and then only keep-alive messages are sent between the servers.DB Error: connect failed
Configuration:
Windows server 2003 R2 Standard edition with SP2
Apache 2.2.9
PHP 5.2.3
Pear 1.7.2
Pear DB 1.7.13
Local SQL server: MS SQL 2008 (v 10.0.1600)
Remote SQL server: MS SQL 2005 (v 9.0.3042)
Any ideas how to solve it ?