donglu6805
donglu6805
2014-09-19 01:15

Cakephp无法连接到sqlserver

已采纳

I got this error :

CakePHP is NOT able to connect to the database.

Database connection "Sqlserver" is missing, or could not be created.

Details :

  • CakePHP 2.5.4
  • Wamp server 32-bit
  • Dreamweaver CS6
  • SQL Server 2014

On my details.php

class DATABASE_CONFIG {

public $default = array(
    'datasource' => 'Database/Sqlserver',
    'persistent' => false,
    'host' => 'localhost\MSSQLSERVER',
    'database' => 'testing'
);

I have load both the extension on both ext folder (apache & php) and on php.ini

extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll

Searched everywhere but still cannot connect to sqlserver.

note : I can connect to MySQL but not SQLServer

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答

  • doudengshen5591 doudengshen5591 7年前

    In the end, i've found the solution. It's the problem of WAMPP server. Tho i have it installed on other machine and it works, it's not the same with the machine i'm currently using. So what i do is:

    1. Uninstall WAMPP
    2. Install XAMPP
    3. Configure php.ini on apache and php
    4. Load extensions in the ext folder of php

    Note : I did the same configuration with WAMPP earlier

    Then everything works like a charm.

    点赞 评论 复制链接分享
  • douyi3833 douyi3833 7年前

    Try to edit another php.ini in C:\wamp\bin\apache\Apache2.x.x\bin\ then restart apache. Also the SQL Server Native Client must be installed for the extension to work.

    点赞 评论 复制链接分享
  • douyangcheng4965 douyangcheng4965 7年前

    Maybe bacause you're not running sqlserver? Wamp is configured with apache/MySQL... hence the WAMP acronym...

    In which case your config file should be similar to the one given in this example...

    http://book.cakephp.org/2.0/en/development/configuration.html

    点赞 评论 复制链接分享

相关推荐