本文介紹了如何讓 php 與 postgresql 一起工作?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
<?php
try {
$dbh = new PDO('pgsql:host=localhost;port=5432;dbname=###;user=###;password=##');
echo "PDO connection object created";
}
catch(PDOException $e)
{
echo $e->getMessage();
}
?>
我收到錯(cuò)誤消息無法加載驅(qū)動(dòng)程序"
I get the error message "Could Not Load Driver"
推薦答案
試試這個(gè):
在 php.ini 中通過刪除;"取消注釋以下內(nèi)容
Uncomment the following in php.ini by removing the ";"
;extension=php_pgsql.dll
使用以下代碼連接到 postgresql 數(shù)據(jù)庫服務(wù)器:
Use the following code to connect to a postgresql database server:
pg_connect("host=localhost dbname=dbname user=username password=password")
or die("Can't connect to database".pg_last_error());
這篇關(guān)于如何讓 php 與 postgresql 一起工作?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!