Hi I am using Laravel PHP framework on CentOS 6.3. I have PostgreSQL 9.1 installed, along with PDO and PDO-PGSQL. Under application/config/database.php
I have set Laravel to use PostgreSQL:
'default' => 'pgsql',
'connections' => array(
'pgsql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'dbname',
'username' => 'username',
'password' => 'shhhpass',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
),
However, visiting any page gives me the error:
Message:
could not find driver
Location:
/home/dev/public_html/laravel/database/connectors/postgres.php on line 37
Any ideas? Thanks!
The line giving that error is this:
$connection = new PDO($dsn, $username, $password, $this->options($config));
It is trying to load the PDO driver for pg.
Did you check that the pdo extension is enabled in PHP configuration files? Check the /etc/php.d/pgsql.ini
and /etc/php.d/pdo.ini
.
Hope this helps.
Run sudo apt-get install php5-pgsql
on your terminal.
In other words, install the PostgreSQL driver for PHP.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.