CakePHP MSSQL connection issue
Posted by: StradivariK (---.cybercable.net.mx)
Date: May 04, 2016 04:22AM

Hello! This is basically my first time i'm trying to connect to a MSSQL, so i'm a little confused if i did everything correctly, because i'm getting this error:

Error: A Database connection using "Sqlserver" was missing or unable to connect.

The database server returned this error: SQLSTATE[08001]: [Microsoft][ODBC Driver 11 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].

I have:

Wampserver 3 (32 bit)
OS: Windows 10 (64 bit)
PHP Version: 5.6.15
Apache Version: 2.4.17


I downloaded and added to "C:/wamp/bin/php/php5.6.15/ext" the files:

php_mssql.dll
php_pdo_sqlsrv_56_ts.dll
php_sqlsrv_56_ts.dll


I modified the file "php.ini" adding the lines:

extension=php_mssql.dll
extension=php_pdo_sqlsrv_56_ts.dll
extension=php_sqlsrv_56_ts.dll

And then i verified that the extensions were added correctly and they are.


In my database.php file i have the following lines:

class DATABASE_CONFIG {

public $default = array(
'datasource' => 'Database/Sqlserver',
'persistent' => false,
'host' => '.\SQLEXPRESS',
'login' => 'sa',
'password' => 'thePassword',
'database' => 'theDatabase',
'prefix' => ''
);
}

The database is a local database on SQL Server 2014 Manager Studio, i created the database recently but i still cant figure out why im still getting that error.

I have also tried to change the host to 'LOCALHOST\SQLEXPRESS' but its still the same.

I would really appreciate if someone could help me with this. smiling smiley

Options: ReplyQuote
Re: CakePHP MSSQL connection issue
Posted by: RiggsFolly (Moderator)
Date: May 04, 2016 12:27PM

Hi

Have you installed the Microsoft Drivers for PHP for SQL Server from [www.microsoft.com]

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.