[英]Pg_connect or die() not returning anything
I have the following code to connect to psql. 我有以下代码连接到psql。 "test1" is the only thing that displays on the page, meaning that something goes wrong in the pg_connect, but the "Could not connect" message doesn't display either.
“ test1”是页面上唯一显示的内容,这意味着pg_connect中出了点问题,但是“ Conot not connect”消息也未显示。 What could be going wrong here?
这里可能出什么问题了? I'm using the same credentials that allow me to connect via navicat.
我使用的凭据相同,因此可以通过navicat进行连接。
<?php
echo 'test1';
$dbconn = pg_connect("host=localhost port=5439 dbname=mydb user=myuser password=mypass") or die('Could not connect: ' . pg_last_error());
echo 'test2';
?>
Probably you don't have PostreSQL extension enabled. 可能您没有启用PostreSQL扩展。
Make sure you in your php.ini file you have line: 确保您在php.ini文件中有以下行:
extension=php_pdo_pgsql.dll
without ; 没有; at the beginning.
一开始。
If you have ; 如果你有 ; at the beginning remove ;
一开始删除; and restart server
然后重启服务器
You may also at the beginning of your file add: 您也可以在文件的开头添加:
error_reporting(E_ALL);
to make sure what the problem is 确保问题出在哪里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.