2013-04-17 13:34
浏览 195


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:

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

When I load this page I see this:

program loaded successfully


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.

    打赏 评论
  • douxuanling6523 2013-04-17 13:37

    postgreSQL should be activates in the php.ini to activate these functions.

    打赏 评论

相关推荐 更多相似问题