Not able to connect to SQL Server 2008 from Zend Framework

Posted on 2012-08-20
Last Modified: 2013-01-12

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:  

debug                                   = true
logging                                  = true
application_root               = "dev\htdocs"
database.type            = sqlsrv
database.adapter         = pdo_sqlsrv     = 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):  
debug                                   = true
logging                                  = true
application_root               = "dev\htdocs"
database.type            = mssql
database.adapter         = pdo_mssql     = 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.
Question by:cartereverett
    LVL 14

    Expert Comment

    by:Scott Madeira

    Accepted Solution

    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.

    Author Closing Comment

    The Zend Framework version was old and incorrect library declaration was used.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
    Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
    The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now