2017-07-13 08:47
浏览 551


I'am trying to run Symfony 3.x with :

  • Ubuntu 16.04
  • PHP 7.0
  • NGinx

I would like to interact with my PGSQL database that I created but I get this error :

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_pdo_pgsql.dll' - /usr/lib/php/20151012/php_pdo_pgsql.dll: cannot open shared object file: No such file or directory in Unknown on line 0

[Doctrine\DBAL\Exception\DriverException] An exception occured in driver: could not find driver
[Doctrine\DBAL\Driver\PDOException] could not find driver

[PDOException] could not find driver

So I looked at my phpinfo() and it seems that pgsql driver is enabled

phpinfo() result

Can anyone help me on this one ?

图片转代码服务由CSDN问答提供 功能建议

我试图运行Symfony 3.x:

    \ n
  • Ubuntu 16.04
  • PHP 7.0
  • NGinx

    我想与之互动 我创建的PGSQL数据库,但是我收到了这个错误:

    PHP警告:PHP启动:无法加载动态库 '/ usr / lib / php / 20151012 /php_pdo_pgsql.dll' - /usr/lib/php/20151012/php_pdo_pgsql.dll:无法打开共享对象 文件:第0行的“未知”中没有此类文件或目录

    [Doctrine \ DBAL \ Exception \ DriverException]驱动程序中出现 异常:找不到驱动程序
    [Doctrine \ DBAL \ Driver \ PDOException]无法找到驱动程序


    所以我查看了我的 phpinfo(),似乎启用了pgsql驱动程序


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • duanhuang2804
    duanhuang2804 2017-07-13 08:53

    You must properly install the PostgreSQL module and enable it.

    P.S. do not use '.dll' files on the servers with UNIX based OS, because these extensions are compiled for the Windows operating system (for UNIX based OS you must use '.so' files).

    点赞 评论
  • dougu2036
    dougu2036 2018-09-10 02:24

    I had a very similar issue:

    I fixed it by applying the same patch as for this subject: pdo_parse_params error in whenever PHP starts in Fedora 20

    In a nutshell: if a module has already been loaded by the /etc/php/7.2/mods-available/<module>.ini (or equivalent path for your OS), then the module should not be uncommented (= made active) in the php.ini files. (two of them, cli and server).

    You may ensure this, by checking phpinfo(), and observe how pdo_pgsql is still active in there, despite the line being commented in php.ini!

    点赞 评论
  • douxiawei9318
    douxiawei9318 2019-01-29 23:29

    I had a similar problem and (after installing the PHP pg driver) I had to add two files to /etc/php.d



    Putting these extension config lines in the php.ini kept giving me the pdo_parse_params error

    点赞 评论