Laravel —— could not find driver

Laravel in the database is a way to connect PDO

When the database connection fails, check the problem, then prescribe the right medicine

In this paper, for example pgsql

 

1, to determine whether to activate pgsql

$ Ps -ef | grip pgsql

 

2, it is determined whether the installation and opening expand pdo_pgsql

$ /usr/local/php/bin/php -m

  There is no need to install, the following is not recompile PHP, direct installation steps pdo_pgsql

-> switching to the package directory PHP extended package directory 
# CD / usr / local / the src / PHP- 7.3 . . 4 / EXT / 

-> performing the phpize 
# / usr / local / PHP / bin / the phpize

 -> performed Configure 
#. / PHP --with-config-Configure = / usr / local / PHP / bin / PHP- config

 -> install 
# the make && the make  the install
 
-> open pdo_pgsql extended 
# Vim / usr / local / PHP / lib / the php.ini 
extension = remove the semicolon in front of pdo_pgsql

 -> restart the service 
service httpd restart

 

3, it is determined Laravel, the connection parameters are correct

// .env file, verify DB configuration 
DB_CONNECTION = pgSQL 
DB_HOST = 127.0 . 0.1 
DB_PORT = 5432 
db_database = "database name" 
db_username = "Database user name" 
DB_PASSWORD = "Database Password"

 

After confirming the above to the test. . .

Guess you like

Origin www.cnblogs.com/rendd/p/11888549.html