Fatal error: Call to undefined function pg_connect()

后端 未结 17 1468
广开言路
广开言路 2020-12-02 23:07

I am trying to connect to my database (remote server) which has PostgreSQL installed in it. My PHP code is trying to connect to the database using pg_connect(), but I get th

17条回答
  •  长情又很酷
    2020-12-02 23:39

    Edit. I just noticed you were mentionning MAMP. My advice is for Windows but may be useful if you know what corresponding tools to use.

    Things to try:

    • Have you restarted PHP and Apache since your editing of php.ini?

    • Is the php_pgsql.dll found in your php\ext directory?

    • Are you running php as a module? If so, try copying the php_pgsql.dll file in the Apache\bin directory.

    • Are you running PHP from the command line with a flag specifying a different php.ini file?

    • You could try using a tool such as Sysinternals' Filemon to view what files are attempting to be accessed when running PHP.

    • You could try using a tool such as Dependency Walker to look at the dependencies for the postgreSQL DLL, in case you have a missing dependency. Quick search brought up ldd for Unix.

提交回复
热议问题