Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 997
  • Last Modified:

Not able to connect to SQL Server 2008 from Zend Framework

HI-

I’m having trouble connecting my SQL Server 2008 Standard SR2 database server with my Apache 2.2 server running PHP version 5.2.10 and Zend framework version 1.5.
The library I’m using is php_pdo_sqlsrv_52_ts_vc6.dll and php5ts.dll.
This library works pretty well previously on a couple servers but these servers are not using Zend framework. For them I’m using a direct call to the PDO class.
I think the problem is the connection string because on my previous servers I change it from
$dbh = new PDO ('mssql:host='.$this->host.';dbname='.$this->database.'',''.$this->user.'',''.$this->password.'');
To this:
$dbh = new PDO ("sqlsrv:server=$this->host;Database=$this->database", $this->user, $this->password);
And it works fine.

But on Zend library I’m not sure where is building the string. I just know it is using the config.ini to get the connection parameters.

See below details on new config.ini file:  

[application]
debug                                   = true
logging                                  = true
application_root               = "dev\htdocs"
database.type            = sqlsrv
database.adapter         = pdo_sqlsrv
database.params.host     = devSQLserver2008
database.params.username = devUser
database.params.password = "Abc_123"
database.params.dbname   = DevDatabase

See below details on old config.ini file (it works fine):  
[application]
debug                                   = true
logging                                  = true
application_root               = "dev\htdocs"
database.type            = mssql
database.adapter         = pdo_mssql
database.params.host     = devSQLserver2005
database.params.username = devUser
database.params.password = "Abc_123"
database.params.dbname   = DevDatabase


When I run my application in any browser I get these errors

Notice: Trying to get property of non-object in D:\Web\htdocs\library\acl\Acl.php on line 84

Warning: Invalid argument supplied for foreach() in D:\Web\htdocs\library\acl\Acl.php on line 84
                                         
Acl.php is just a class to check information from the database using the Zend framework. This class works fine with the previous setup.



I will appreciate any comment about how fix this problem. Thanks.
0
cartereverett
Asked:
cartereverett
  • 2
1 Solution
 
cartereverettAuthor Commented:
This issue has been fixed using the last Zend Framework Version 1.11.13. Additionally I did a change in my php.ini configuration file to use the extension php_sqlsrv_52_ts_vc6.dll instead of php_pdo_sqlsrv_52_ts_vc6.dll.
0
 
cartereverettAuthor Commented:
The Zend Framework version was old and incorrect library declaration was used.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now