ID: 45294
Updated by: [EMAIL PROTECTED]
Reported By: lowee at lowee dot net
-Status: Open
+Status: Feedback
-Bug Type: CGI related
+Bug Type: PDO related
Operating System: windows 2003
PHP Version: 5.2.6
New Comment:
Check what php.ini file is actually loaded. Most likely you're just
missing the proper extensions. Then change that script a bit:
<?php
define('DB_HOST','192.168.1.20');
define('DB_NAME','db1');
define('DB_USER','user');
define('DB_PASS','pass');
try {
$pdo = new
PDO('mssql:host='.DB_HOST.'dbname='.DB_NAME,DB_USER,DB_PASS);
}catch (PDOException $e) {
print $e->getMessage();
}
?>
And post the output here.
Previous Comments:
------------------------------------------------------------------------
[2008-06-17 11:13:30] lowee at lowee dot net
Description:
------------
php cli with pdo and ms sql
it is working on any web browser but on php cli it is not working
Reproduce code:
---------------
define('DB_HOST','192.168.1.20');
# mtc_awdb
# mtc_hds
define('DB_NAME','db1');
define('DB_USER','user');
define('DB_PASS','pass');
$dbhandle = mssql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't
connect to SQL Server on");
try {
$pdo = new
PDO('mssql:host='.DB_HOST.';dbname='.DB_NAME,DB_USER,DB_PASS);
}catch (PDOException $e) {
print $e->getMessage();
}
Expected result:
----------------
to show me that it is connected
Actual result:
--------------
1 - SQLSTATE[01002] Unable to connect: SQL Server is unavailable or
does not exist.
(severity 9)
2 - SERVER not available
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45294&edit=1