douti9253 2013-04-17 13:34
浏览 211
已采纳

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

I'm developing my first program with php. I searched a lot of forums and about 3 or 4 hours, but got nothing.

Here is my index.php code:

<html>
<head>
   <title>first program</title>
</head>
<body>
    <h1> program loaded successfully</h1>
    <?php
        echo extension_loaded('pgsql') ? 'yes':'no';
        echo pg_connect("host=localhost port=5432 dbname=test user=postgres password=root");
    ?>
</body>

When I load this page I see this:

program loaded successfully

no

Fatal error: Call to undefined function pg_connect() in D:\courses\web programing\hw2\cinema\index.php on line 9

I installed php-5.4.14-Win32-VC9-x86 on my windows and run my project with this comment:

php.exe" -S localhost:80 -t "D:\courses\web programing\hw2\cinema"

I have php.ini-development and php.ini-production in php folder and Uncommented extension=php_pgsql.dll, extension=php_pdo_pgsql.dll in both files. I'm using postgresql 9.2

So where is my mistake?

  • 写回答

2条回答 默认 最新

  • douzao5487 2013-04-17 15:06
    关注

    Solved It's wired but the problem was that php try to load php.ini from Windows folder and no php.ini exist there. So I copied one of my php.ini files in Windows folder and problem solved. It seems like a bug.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料