NetTalk Central

Author Topic: Connect to MS SQL via PHP  (Read 1275 times)

estadok

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • EstaSoft
    • Email
Connect to MS SQL via PHP
« on: February 13, 2013, 10:42:09 PM »
Hi!

I have an issue regarding making a connection to mssql via php.

I use PHP 5.3.14 (TS),  SQL driver for php v 5.3 (TS).

The problem is that  when i try to serve php file, for example config.php, which contains script like:

Code: [Select]
<?php

$serverName 
"SERVER";
$connectionInfo = array( "Database"=>"TestToken");
$conn sqlsrv_connect$serverName$connectionInfo);

if( 
$conn )
{
     echo 
"Connection established.\n";
}
else
{
     echo 
"Connection could not be established.\n";
     die( 
print_rsqlsrv_errors(), true));
}

?>


Engine says "Connection could not be established." and no any other sql errors....

But when I am sending this file directly to php-cgi.exe -f somepath/config.php I get message "Connection established."
What am I doing wrong or maybe I just don't understand something? If anyone had experienced this problem before, please provide a hint. Any help will be greatly appreciated.
Clarion 9.0.10376
NetTalk 7.26
SecWin 6.25
StringTheory 1.92

estadok

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • EstaSoft
    • Email
Re: Connect to MS SQL via PHP
« Reply #1 on: February 25, 2013, 12:44:41 AM »
Can anyone help?
Clarion 9.0.10376
NetTalk 7.26
SecWin 6.25
StringTheory 1.92

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: Connect to MS SQL via PHP
« Reply #2 on: February 25, 2013, 01:09:03 AM »
you might be better googling for php stuff. I don't think too many people here are using PHP. Personally I've not used it, so I won't be much help in answering PHP specific questions - sorry.

cheers
Bruce