2

I am trying to connect to a Microsoft SQL Server database, with CakePHP 2.2.4. As my dev environment I have installed a fresh WAMP Server on my machine.

I have enabled the PHP extensions:

  • php_mssql
  • php_pdo_mssql
  • php_sqlsrv_53_ts
  • php_curl (this one might be irrelevant).

I also have enabled the module in Apache:

  • rewrite_module.

I have have changed the salt entries in the core.php file. I have tried to connect to my database through database.php as so:

public $default = array(
    'datasource' => 'Database/Sqlserver',
    'persistent' => false,
    'host' => 'Servername',
    'login' => 'Username',
    'password' => 'secretpassword',
    'database' => 'TheDatabase',
    'prefix' => '',
    //'encoding' => 'utf8',
);

I go to the index.php to test the connection and i get in yellow:

Cake is NOT able to connect to the database. Database connection "Sqlserver" is missing, or could not be created.

I see that it is failing at the datasource so it must be some module or extension or dll or something missing ... The server is located within our intranet, if that helps.

1 Answer 1

2

The DataSource is defined in the file lib/Cake/Model/Datasource/Database/Sqlserver.php

Requires the sqlsrv * and pdo_sqlsrv extensions to be enabled."

Check phpinfo() to see if the extensions are enabled.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.