0

I intalled correctly PostgreSQL and is running ok, as I can access the DB via the admin tool.

I'm trying to configure PHP 5.2.13 to load postgres extension, but failed so far, I don't get any information in PHP error log or Apache error log. So far I've done:

  • Include PostgreSQL bin on windows path
  • Copy php_pgsql.dll from my php/ext folder into system32 folder (also tryied other folders in the system path)
  • Include the lines extension=php_pgsql.dll in php.ini and/or LoadFile "C:/Program Files/PostgreSQL/9.0/bin/libpq.dll" in httpd.conf, both together and separately, all of the combinations resulting in Apache unable to restart without any log message.

I followed these instructions and others from php.net, but failed so char.

Any ideas or help?

Thank you

5
  • You don't have to (and cannot) load any pgsql dlls in Apache. Commented Jun 18, 2011 at 11:37
  • It could be useful to write the message of error. And to look at related questions (right panel of this page). Commented Jun 18, 2011 at 11:37
  • stackoverflow.com/questions/551734/… Commented Jun 18, 2011 at 14:03
  • Milen, I already read that but don't really understand it, if I download a zipped version of PostrgreSQL all I see is this: comerr64.dll, gssapi64.dll, k5sprt64.dll, krb5_64.dll, libeay32.dll, pgenlist.dll, pgenlista.dll, pgxalib.dll, psqlodbc30a.dll, psqlodbc35w.dll, ssleay32.dll no php_nothing.dll Commented Jun 18, 2011 at 14:10
  • php_pgsql.dll is a PHP extension, it's part of the PHP bundle for Windows. But it needs other DLLs (the ones you listed) to function correctly. Also it's a good idea to cite the error you recieve or what's not working and when. Commented Jun 18, 2011 at 15:53

3 Answers 3

2

php_pgsql.dll have to be in the ext folder of your PHP installation. After you put the file there and enabled in in php.ini (the way you did) you have to restart the web server. After that you have to see PostreSQL extension in your phpinfo()

Sign up to request clarification or add additional context in comments.

6 Comments

I'm doing that, included php/ext in path (just in case), but I'm not able to start apache when I try to load extension in php.ini, all message I have is this in apache error.log:
[Sat Jun 18 13:44:48 2011] [warn] pid file C:/Program Files (x86)/Apache Software Foundation/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
I don't think apache needs to load the pg library. Try reverting the httpd.conf and enabling pg extension only in php. Additionally, set the display_stratup_errors to 1 in php.ini, to see any errors while php tries to load the extension.
I'm only loading php extension, httpd.conf is in it's original state, but still no apache start. Thanks for yor help
I think you have problem with apache configuration, but try disabling the extension in php.ini as well to see if apache will be running. By the way, if you are using this as a development machine, you may be interested in installing wamp - it's really easy to enable and disable extensions there (it is a pre-configured package of apache,mysql and php with a control panel to manage your configuration)
|
1

Starting from PostgreSQL 9.3 and above Apache will not start with libpq.dll supplied with PostgreSQL. Instead in httpd.conf file of Apache set the path to the libpq.dll of PHP catalog. In my case it is:

LoadFile "D:/PHP5.6.3/libpq.dll"

Comments

1

In addition to your steps above, try setting PHP extensions from within Wampserver by left clicking on Wampserver (green) icon -> PHP -> PHP Extensions -> click next to these extensions in the list (to check):

  • pdo_pgsql
  • pgsql

Here's my setup:

  1. Windows 10,
  2. Wampserver 3.1.9 (x64) which contains:
    • Apache 2.4.39,
    • PHP 7.3.7,
    • MySQL 5.7.24
  3. PostgreSQL 11

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.