doucong3048 2016-03-07 08:46
浏览 63

与MSSQL(sqlsrv)的Symfony导致超时

I am trying to connect Symfony 2.8 to Microsoft SQL Server 2012 by using sqlsrv extension (no pdo sqlsrv, because for php7 - which I am using - there is currently only non pdo).

Trying to run cache clear or access the site in browser results in

"PDO::__construct(): MySQL server has gone away".

When I run the doctrine schema update command, everything works fine and the tables are being generated. Does anyone know how to fix the error? (I don't even know why it says Mysql server gone away when I try to connect on microsoft sql..)

Config:

# Doctrine Configuration
doctrine:
dbal:
    default_connection: default
    connections:
        default:
          driver: sqlsrv
          host: testhost
          dbname: testdb
          user: testuser
          password: testpw
          mapping_types:
            timestamp: string

I am looking for a solution since Friday but was not able to find one. I tried to select some entries from a seperate (non symfony) php skript, and there I got the results and no timeout. Why is Symfony / Doctrine giving me this strange error?

  • 写回答

1条回答 默认 最新

  • dtz33344 2016-03-07 09:21
    关注

    you can try to launch this command for doctrine :

    php app/console doctrine:cache:clear-metadata
    php app/console doctrine:cache:clear-query
    php app/console doctrine:cache:clear-result
    

    Also perhaps upgrade and downgrade your doctrine bundle for restore a correct and initial version of bundle for your project.

    评论

报告相同问题?