PostgreSql 'PDOException' with message 'could not find driver'

后端 未结 9 1888
悲&欢浪女
悲&欢浪女 2020-12-09 15:30

pdo is working fine with mysql but with pgsql its giving error \'PDOException\' with message \'could not find driver\' I\'ve installed php5-pgsql p

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 16:03

    I had the same problem with another solution. I lost my around 4 hours to solve this problem. Please check the following to solve this problem.

    1. Check php.ini file and remove semicolon from this line

      extension=pgsql

      extension=pdo_pgsql

    2. Restart your apache2 server

      sudo service apache2 restart

    3. Check if your PDO driver has updated in localhost phpinfo()

    I did All the things right and still I had this problem. And you know why? Because I had several versions of php installed. So I was running php7.4 in my php cli but localhost was running on php7.2. So always check your php versions.

    1. Check your php version on localhost and terminal cli

提交回复
热议问题