php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68646 Cannot load pgsql extension
Submitted: 2014-12-24 10:12 UTC Modified: 2014-12-25 15:54 UTC
From: tony at marston-home dot demon dot co dot uk Assigned:
Status: Not a bug Package: PostgreSQL related
PHP Version: 5.6.4 OS: Windows 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tony at marston-home dot demon dot co dot uk
New email:
PHP Version: OS:

 

 [2014-12-24 10:12 UTC] tony at marston-home dot demon dot co dot uk
Description:
------------
I tried to re-open bug #68378 but it wouldn't let me. The error message said "You aren't allowed to change a bug to that state.".

I am running Windows 7 with Apache 2.4.10 and Oracle 11g. After upgrading my PHP version from 5.5.18 to 5.6.4 I can longer use the pgsqlextension as my code fails with "Call to undefined function pg_connect()". When I run phpinfo() it shows that the pgsql extension is not loaded.

When I look in the Apache error log it shows no errors. When I look in the Windows event viewer it also shows no errors.

This was working perfectly with PHP 5.5.18, so why should a simple upgrade to 5.6.4 cause such a problem?

I did not edit my php.ini file as I was using exactly the same settings as before. All I did was replace the PHP 5.5.18 code with that for 5.6.4 and this extension failed to work as I expected.


Expected result:
----------------
I expect the pgsql extension to be loaded and usable.

Actual result:
--------------
The pgsql extension is not loaded, and there are no error messages explaining why.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-24 13:00 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2014-12-24 13:00 UTC] ab@php.net
@tony at marston-home dot demon dot co dot uk, it doesn't really help to open a new ticket if you gave no feedback in the previous one. Please check what requinix was asking you there, then lets see further.

Thanks.
 [2014-12-24 15:12 UTC] tony at marston-home dot demon dot co dot uk
-Status: Feedback +Status: Open
 [2014-12-24 15:12 UTC] tony at marston-home dot demon dot co dot uk
No, I did not edit the wrong php.ini file. I did not edit any file at all as I already had a working PHP installation. All I did was overwrite my 5.5.18 installation with the files for 5.6.4, and the pgsql extension simply stopped working.
 [2014-12-24 17:29 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2014-12-24 17:29 UTC] ab@php.net
Ok, so this is checked. Please do the following


cd <5.6 folder path>
php -n -d extension_dir=ext -d extension=php_pgsql.dll -m

do you see the pgsql ext loading?

Thanks.
 [2014-12-25 10:47 UTC] tony at marston-home dot demon dot co dot uk
-Status: Feedback +Status: Open
 [2014-12-25 10:47 UTC] tony at marston-home dot demon dot co dot uk
This is the output I get from that command:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

F:\PHP5>php -n -d extension_dir=ext -d extension=php_pgsql.dll -m
[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
ereg
filter
ftp
hash
iconv
json
libxml
mcrypt
mhash
mysqlnd
odbc
pcre
PDO
pgsql
Phar
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]


F:\PHP5>

The pgsql extension is still not showing in phpinfo().
 [2014-12-25 11:44 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2014-12-25 11:44 UTC] ab@php.net
With this you see that the pgsql ext itself isn't broken. You need to revisit your configuration under Apache. Please note, that Apache does chroot away from the php dir. So check what you have on the %path% when Apache starts. Also ensure that php.ini has correct path to the extension_dir. 

Thanks
 [2014-12-25 11:51 UTC] ab@php.net
Also, from what i see in the bug #68645 - ext with different SAPI, and - as you told you was doing an overwrite. That probably something on shouldn't do. Yes, you might be able reuse the php.ini (but check also), but don't do overwrite - replace the dir. I'd advise you to start from backing up your old f:\php5 and extracting new fresh zipball, then putting the old/revisited php.ini in there.

Thanks.
 [2014-12-25 14:37 UTC] tony at marston-home dot demon dot co dot uk
I did not change my Apache configuration, nor did I change my postgresql installation. My httpd.conf file contains the same LoadFile "E:\Program Files (x86)\PostgreSQL\9.2\bin\libpq.dll" directive that it did with the previous PHP installation. I did not overwrite the php.ini file as that exists in the C:/windows directory and not the F:/PHP5 directory.

Your reference to me using a different SAPI is incorrect.

My extension_dir setting remains unchanged at F:/php5/ext

I repeat, all I have done is upgrade the files in my F:/PHP5 directory. The pgsql extension no longer shows up in phpinfo() and is therefore not usable.
 [2014-12-25 15:00 UTC] ab@php.net
Ok, now as you've mentioned libpq.dll, i probably see what is wrong. It is so, that the libpq.dll is supplied with PHP. Please use it. 

From what i can see, the libpq.dll from the postges distribution is compiled with VC10 while we use VC11 for PHP 5.5+. It colud be a luck that the method you've described was working at all, but it's definitely not the right way.

Ah, and seems you was pulling a 32 bit libpq.dll, does that match your php bitness?

Thanks.
 [2014-12-25 15:03 UTC] ab@php.net
Ah, my typing error. Not SAPI, but API. As it was showing "different module API" error, so i suppose something went wrong with your overwriting. Also - even within the same minor version some files could have gone or changed. So it's always better not to overwrite, but to replace the whole dir.
 [2014-12-25 15:10 UTC] tony at marston-home dot demon dot co dot uk
Yes, I am using 32bit PHP although Windows 7 is 64 bit.

I have replaced file "E:\Program Files (x86)\PostgreSQL\9.2\bin\libpq.dll" with the latest one from the PHP installation, and the extension is working now.

Many thanks.
 [2014-12-25 15:54 UTC] ab@php.net
Great! Most of the dependency DLL are delivered in the PHP zipball. They're strongly recommended to use. Though there are some not delivered for various reasons (like the oci one).

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC