0

I have tried to setup both quickapp -cms and croogo- cms with cake php 2.8.6 and sqlserver 2016 . It works fine with mysql but failed with sql server . I encounter following error :

cake php 2.8.6
php 5.6.23
Ms sql server
Microsoft SQL Server Management Studio                      13.0.15700.28
Microsoft Analysis Services Client Tools                        13.0.1700.68
Microsoft Data Access Components (MDAC)                     6.2.9200.16384
Microsoft MSXML                     3.0 6.0 
Microsoft Internet Explorer                     9.10.9200.17607
Microsoft .NET Framework                        4.0.30319.42000
Operating System                        6.2.9200

====================================================================================
Unable to connect to database, please check your information. Details:
Connection to database could not be established: SQLSTATE[IMSSP]: An invalid encoding was specified for SQLSRV_ATTR_ENCODING.


================================================================================

My db config :

    'datasource' => 'Database/Sqlserver',
    'persistent' => false,
    'host' => 'COLLONMADE\SQLEXPRESS',
    'login' => 'sa',
    'password' => 'root',
    'database' => 'cro',
    'prefix' => '',
    'encoding' => 'utf8',
4
  • stackoverflow.com/questions/20042778/cakephp-sqlserver-encoding Commented Sep 10, 2016 at 14:49
  • I already tried it but problem still persists Commented Sep 10, 2016 at 16:15
  • Try to change the encoding value, i.e UTF8, utf-8, iso_1, etc Commented Sep 11, 2016 at 13:04
  • @sємsєм Its also not working . I also added collation same displayed in database properties . but failed . :( Commented Sep 12, 2016 at 6:05

1 Answer 1

1

Finally I found solution which is not optimum As I think but works in my case . Thanks all to answer this question . I have tried this with croogo cms version 1.4.3 and 1.5.8 both works perfectly .

go to myapp\lib\Cake\Model\Datasource\Database\Sqlserver.php

and comment out flags lines as below :

/*$flags = array(
            PDO::ATTR_PERSISTENT => $config['persistent'],
            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
        );

        if (!empty($config['encoding'])) {
            $flags[PDO::SQLSRV_ATTR_ENCODING] = $config['encoding'];
        }*/

        try {
            $this->_connection = new PDO(
                "sqlsrv:server={$config['host']};Database={$config['database']}",
                $config['login'],
                $config['password']
                //$flags
            );

After this change you will able to go to next step where in croogo you will get internal server error which is because it has not created settings table so go to:

config/schema/sql/croogo.sql

and copy insert query of settings table and execute in your database.

now again go to install procedure you will be able to finish all steps and login .

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.