Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在linux中使用Php(windowns 7)连接PostgreSQL_Php - Fatal编程技术网

如何在linux中使用Php(windowns 7)连接PostgreSQL

如何在linux中使用Php(windowns 7)连接PostgreSQL,php,Php,我想用windows中的php连接到linux中的PostgreSQL 致命错误:调用未定义的函数pg_connect 谢谢。PDO比connet数据库更适合。 为此,您需要为pg_sql启用PDO。请为pg_sql更改php.ini文件 $hostname = "localhost"; $database = "postsgres"; $username = "postgres"; $password = "postgres"; try{ $dbh = new PDO("pgsql:d

我想用windows中的php连接到linux中的PostgreSQL

致命错误:调用未定义的函数pg_connect


谢谢。

PDO比connet数据库更适合。 为此,您需要为pg_sql启用PDO。请为pg_sql更改php.ini文件

$hostname = "localhost";
$database = "postsgres";
$username = "postgres";
$password = "postgres";
try{
    $dbh = new PDO("pgsql:dbname=$database;host=$hostname",$username,$password);
} catch (Exception $ex) {
    echo $ex->getMessage();
}

你能把你的问题说清楚一点吗?我们需要您的设置和代码等信息才能提供建议。您已经说过,在windows中添加了。同样,你的问题不清楚。你的意思是我想做点什么。在Linux中使用PHP在Windows中连接PostgreSQL是什么意思?你有什么密码?什么不起作用?你想发生什么?你尝试过什么?linux中的PostgreSQL和windows中的php:o,你能解释一下吗?请添加一些代码James先生,我的意思是通过Windows中的PHP连接到Linux中的PostgreSQL,我的代码错误消息:致命错误:调用C:\AppServ\www\test.PHP中未定义的函数pg_connect,我从未在Linux上设置过。函数pg_connect不存在。这就是你的出发点。功能代码或文件不包括?我已经尝试过这种方法,但它不工作。我应该设置什么配置?详细信息:我安装了appserv-win32-2.6。0@Siwan,这个新信息本来应该在您的问题中,因为现在rut2试图帮助您回答他们的问题,但是由于缺乏您提供的信息,他们不得不猜测您想要什么,这浪费了他们的时间。你需要在你的问题中添加一些细节。就目前情况而言,你问的问题非常不清楚,我们也不知道你试过什么。我们愿意提供帮助,但你必须在自己身上下功夫,提出一个像样的问题,我们实际上可以回答。