PostgreSQl, PHP and IIS

‹ Previous Topic Next Topic ›
 
♦
♦
9 messages Options
Mark Williams-2
Reply | Threaded
Open this post in threaded view
♦
♦
|

PostgreSQl, PHP and IIS

Mark Williams-2

I have PHP v7.2.7 and PostgreSQL v10 with Windows IIS.

 

I am trying to get this to work following any advice I have been able to find on the web, but with no success. My configuration so far is as below.

 

PHP.ini extension list includes both php_pdo_pgsql.dll and php_pgsql.dll.

 

Both these dlls are located in the correct extensions directory according to phpinfo.

 

According to phpinfo the Configuration File Path is "C:\Windows" and the Loaded Configuration File is "C:\Program Files\PHP\v7.2\php.ini". I have the same php.ini file at both locations.

 

I have copied the version of libpq.dll from the lib folder of the postgresql installation to the root folder of the PHP installation.

 

I have added the bin folder of the postgresql installation to the Windows system search path.

 

Phpinfo shows that pdo_pgsql extension is loaded but not pgsql.

 

I have also tried copying the dependent dlls (ssleay32.dll, libeay32.dll, libintl-8.dll, libiconv-2.dll) from the postgresql bin folder to the php root folder).

 

Phpinfo show php_pdo_pgsql is enabled, but not php_pgsql.dll and an undefined function call error is displayed by php when I try and run any pg php functions.

 

Can anyone please shed any light on what more I need to do?

 

Regards,

 

Mark

Adrian Klaver-4
Reply | Threaded
Open this post in threaded view
♦
♦
|

Re: PostgreSQl, PHP and IIS

Adrian Klaver-4
On 9/21/18 10:35 AM, Mark Williams wrote:

> I have PHP v7.2.7 and PostgreSQL v10 with Windows IIS.
>
> I am trying to get this to work following any advice I have been able to
> find on the web, but with no success. My configuration so far is as below.
>
> PHP.ini extension list includes both php_pdo_pgsql.dll and php_pgsql.dll.
>
> Both these dlls are located in the correct extensions directory
> according to phpinfo.
>
> According to phpinfo the Configuration File Path is "C:\Windows" and the
> Loaded Configuration File is "C:\Program Files\PHP\v7.2\php.ini". I have
> the same php.ini file at both locations.
>
> I have copied the version of libpq.dll from the lib folder of the
> postgresql installation to the root folder of the PHP installation.
>
> I have added the bin folder of the postgresql installation to the
> Windows system search path.
>
> Phpinfo shows that pdo_pgsql extension is loaded but not pgsql.
>
> I have also tried copying the dependent dlls (ssleay32.dll,
> libeay32.dll, libintl-8.dll, libiconv-2.dll) from the postgresql bin
> folder to the php root folder).
>
> Phpinfo show php_pdo_pgsql is enabled, but not php_pgsql.dll and an
> undefined function call error is displayed by php when I try and run any
> pg php functions.
>
> Can anyone please shed any light on what more I need to do?

So what is the error you are getting?

Or to put it another way, what is not happening?

>
> Regards,
>
> Mark
>


--
Adrian Klaver


Mark Williams-2
Reply | Threaded
Open this post in threaded view
♦
♦
|

RE: PostgreSQl, PHP and IIS

Mark Williams-2
"Fatal error: Call to undefined function pg_connect".

Obviously, that is to be expected if pgsql module is not loading.

__

-----Original Message-----
From: Adrian Klaver < >
Sent: 21 September 2018 23:02
To: Mark Williams < >;

Subject: Re: PostgreSQl, PHP and IIS

On 9/21/18 10:35 AM, Mark Williams wrote:
> I have PHP v7.2.7 and PostgreSQL v10 with Windows IIS.
>
> I am trying to get this to work following any advice I have been able
> to find on the web, but with no success. My configuration so far is as
below.

>
> PHP.ini extension list includes both php_pdo_pgsql.dll and php_pgsql.dll.
>
> Both these dlls are located in the correct extensions directory
> according to phpinfo.
>
> According to phpinfo the Configuration File Path is "C:\Windows" and
> the Loaded Configuration File is "C:\Program Files\PHP\v7.2\php.ini".
> I have the same php.ini file at both locations.
>
> I have copied the version of libpq.dll from the lib folder of the
> postgresql installation to the root folder of the PHP installation.
>
> I have added the bin folder of the postgresql installation to the
> Windows system search path.
>
> Phpinfo shows that pdo_pgsql extension is loaded but not pgsql.
>
> I have also tried copying the dependent dlls (ssleay32.dll,
> libeay32.dll, libintl-8.dll, libiconv-2.dll) from the postgresql bin
> folder to the php root folder).
>
> Phpinfo show php_pdo_pgsql is enabled, but not php_pgsql.dll and an
> undefined function call error is displayed by php when I try and run
> any pg php functions.
>
> Can anyone please shed any light on what more I need to do?

So what is the error you are getting?

Or to put it another way, what is not happening?

>
> Regards,
>
> Mark
>


--
Adrian Klaver



Daniel Verite
Reply | Threaded
Open this post in threaded view
♦
♦
|

Re: PostgreSQl, PHP and IIS

Daniel Verite
In reply to this post by Mark Williams-2
        Mark Williams wrote:

> Can anyone please shed any light on what more I need to do?

Overall, what you did looks good.
I've never used IIS, but when faced with similar problems with Apache,
ProcessExplorer [1] has been quite effective to figure out which
dependent DDLs were missing, where PHP was searching for them,
and the precise errors it encountered.

[1] https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer:


Adrian Klaver-4
Reply | Threaded
Open this post in threaded view
♦
♦
|

Re: PostgreSQl, PHP and IIS

Adrian Klaver-4
In reply to this post by Mark Williams-2
On 9/22/18 3:06 AM, Mark Williams wrote:
> "Fatal error: Call to undefined function pg_connect".
>
> Obviously, that is to be expected if pgsql module is not loading.

Went back over your previous post and saw:

"I have copied the version of libpq.dll from the lib folder of the
postgresql installation to the root folder of the PHP installation.

I have added the bin folder of the postgresql installation to the
Windows system search path.
"

I would say add the lib/ of the Postgres install to the search path.

>
> __
>
> -----Original Message-----
> From: Adrian Klaver < >
> Sent: 21 September 2018 23:02
> To: Mark Williams < >;
>
> Subject: Re: PostgreSQl, PHP and IIS
>
> On 9/21/18 10:35 AM, Mark Williams wrote:
>> I have PHP v7.2.7 and PostgreSQL v10 with Windows IIS.
>>
>> I am trying to get this to work following any advice I have been able
>> to find on the web, but with no success. My configuration so far is as
> below.
>>
>> PHP.ini extension list includes both php_pdo_pgsql.dll and php_pgsql.dll.
>>
>> Both these dlls are located in the correct extensions directory
>> according to phpinfo.
>>
>> According to phpinfo the Configuration File Path is "C:\Windows" and
>> the Loaded Configuration File is "C:\Program Files\PHP\v7.2\php.ini".
>> I have the same php.ini file at both locations.
>>
>> I have copied the version of libpq.dll from the lib folder of the
>> postgresql installation to the root folder of the PHP installation.
>>
>> I have added the bin folder of the postgresql installation to the
>> Windows system search path.
>>
>> Phpinfo shows that pdo_pgsql extension is loaded but not pgsql.
>>
>> I have also tried copying the dependent dlls (ssleay32.dll,
>> libeay32.dll, libintl-8.dll, libiconv-2.dll) from the postgresql bin
>> folder to the php root folder).
>>
>> Phpinfo show php_pdo_pgsql is enabled, but not php_pgsql.dll and an
>> undefined function call error is displayed by php when I try and run
>> any pg php functions.
>>
>> Can anyone please shed any light on what more I need to do?
>
> So what is the error you are getting?
>
> Or to put it another way, what is not happening?
>
>>
>> Regards,
>>
>> Mark
>>
>
>
> --
> Adrian Klaver
>
>
>


--
Adrian Klaver


Mark Williams-2
Reply | Threaded
Open this post in threaded view
♦
♦
|

RE: PostgreSQl, PHP and IIS

Mark Williams-2
Thanks for the suggestions.

I don't think there is any dependencies in the lib folder, but added it anyway and it made no difference.

I tried "Process Explorer" (having previously tried "Dependency Walker") PE revealed one or two more dependencies I was previously unaware of. Added these to the root PHP folder, but still got me no further. I have even added Postgres.EXE to the php root folder.

In desperation I tried adding all the postgres files to the PHP Ext folder. Unsurprisingly that did not yield results either.

Does anyone know of a step by step guide for installing php and postgres on windows server? So I can doublecheck to see if there is anything I have missed. I can only assume I have made some simple mistake as it surely can't be this difficult to set up.

Cheers,

Mark

__

-----Original Message-----
From: Adrian Klaver < >
Sent: 22 September 2018 16:45
To: Mark Williams < >;
Subject: Re: PostgreSQl, PHP and IIS

On 9/22/18 3:06 AM, Mark Williams wrote:
> "Fatal error: Call to undefined function pg_connect".
>
> Obviously, that is to be expected if pgsql module is not loading.

Went back over your previous post and saw:

"I have copied the version of libpq.dll from the lib folder of the postgresql installation to the root folder of the PHP installation.

I have added the bin folder of the postgresql installation to the Windows system search path.
"

I would say add the lib/ of the Postgres install to the search path.

>
> __
>
> -----Original Message-----
> From: Adrian Klaver < >
> Sent: 21 September 2018 23:02
> To: Mark Williams < >;
>
> Subject: Re: PostgreSQl, PHP and IIS
>
> On 9/21/18 10:35 AM, Mark Williams wrote:
>> I have PHP v7.2.7 and PostgreSQL v10 with Windows IIS.
>>
>> I am trying to get this to work following any advice I have been able
>> to find on the web, but with no success. My configuration so far is
>> as
> below.
>>
>> PHP.ini extension list includes both php_pdo_pgsql.dll and php_pgsql.dll.
>>
>> Both these dlls are located in the correct extensions directory
>> according to phpinfo.
>>
>> According to phpinfo the Configuration File Path is "C:\Windows" and
>> the Loaded Configuration File is "C:\Program Files\PHP\v7.2\php.ini".
>> I have the same php.ini file at both locations.
>>
>> I have copied the version of libpq.dll from the lib folder of the
>> postgresql installation to the root folder of the PHP installation.
>>
>> I have added the bin folder of the postgresql installation to the
>> Windows system search path.
>>
>> Phpinfo shows that pdo_pgsql extension is loaded but not pgsql.
>>
>> I have also tried copying the dependent dlls (ssleay32.dll,
>> libeay32.dll, libintl-8.dll, libiconv-2.dll) from the postgresql bin
>> folder to the php root folder).
>>
>> Phpinfo show php_pdo_pgsql is enabled, but not php_pgsql.dll and an
>> undefined function call error is displayed by php when I try and run
>> any pg php functions.
>>
>> Can anyone please shed any light on what more I need to do?
>
> So what is the error you are getting?
>
> Or to put it another way, what is not happening?
>
>>
>> Regards,
>>
>> Mark
>>
>
>
> --
> Adrian Klaver
>
>
>


--
Adrian Klaver



Adrian Klaver-4
Reply | Threaded
Open this post in threaded view
♦
♦
|

Re: PostgreSQl, PHP and IIS

Adrian Klaver-4
On 9/23/18 3:54 AM, Mark Williams wrote:
> Thanks for the suggestions.
>
> I don't think there is any dependencies in the lib folder, but added it anyway and it made no difference.
>
> I tried "Process Explorer" (having previously tried "Dependency Walker") PE revealed one or two more dependencies I was previously unaware of. Added these to the root PHP folder, but still got me no further. I have even added Postgres.EXE to the php root folder.
>
> In desperation I tried adding all the postgres files to the PHP Ext folder. Unsurprisingly that did not yield results either.
>
> Does anyone know of a step by step guide for installing php and postgres on windows server? So I can doublecheck to see if there is anything I have missed. I can only assume I have made some simple mistake as it surely can't be this difficult to set up.

Maybe this?:

https://docs.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php

>
> Cheers,
>
> Mark
>
> __
>
> -----Original Message-----
> From: Adrian Klaver < >
> Sent: 22 September 2018 16:45
> To: Mark Williams < >;
> Subject: Re: PostgreSQl, PHP and IIS
>
> On 9/22/18 3:06 AM, Mark Williams wrote:
>> "Fatal error: Call to undefined function pg_connect".
>>
>> Obviously, that is to be expected if pgsql module is not loading.
>
> Went back over your previous post and saw:
>
> "I have copied the version of libpq.dll from the lib folder of the postgresql installation to the root folder of the PHP installation.
>
> I have added the bin folder of the postgresql installation to the Windows system search path.
> "
>
> I would say add the lib/ of the Postgres install to the search path.
>
>>



--
Adrian Klaver


Mark Williams-2
Reply | Threaded
Open this post in threaded view
♦
♦
|

RE: PostgreSQl, PHP and IIS

Mark Williams-2
Hi thanks,

Sadly PHP and IIS isn't the issue. It’s when you bring Postgres into the fold that I am getting a problem. But thanks.

Mark

__

-----Original Message-----
From: Adrian Klaver < >
Sent: 23 September 2018 15:36
To: Mark Williams < >; ;
Subject: Re: PostgreSQl, PHP and IIS

On 9/23/18 3:54 AM, Mark Williams wrote:
> Thanks for the suggestions.
>
> I don't think there is any dependencies in the lib folder, but added it anyway and it made no difference.
>
> I tried "Process Explorer" (having previously tried "Dependency Walker") PE revealed one or two more dependencies I was previously unaware of. Added these to the root PHP folder, but still got me no further. I have even added Postgres.EXE to the php root folder.
>
> In desperation I tried adding all the postgres files to the PHP Ext folder. Unsurprisingly that did not yield results either.
>
> Does anyone know of a step by step guide for installing php and postgres on windows server? So I can doublecheck to see if there is anything I have missed. I can only assume I have made some simple mistake as it surely can't be this difficult to set up.

Maybe this?:

https://docs.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php

>
> Cheers,
>
> Mark
>
> __
>
> -----Original Message-----
> From: Adrian Klaver < >
> Sent: 22 September 2018 16:45
> To: Mark Williams < >;
> Subject: Re: PostgreSQl, PHP and IIS
>
> On 9/22/18 3:06 AM, Mark Williams wrote:
>> "Fatal error: Call to undefined function pg_connect".
>>
>> Obviously, that is to be expected if pgsql module is not loading.
>
> Went back over your previous post and saw:
>
> "I have copied the version of libpq.dll from the lib folder of the postgresql installation to the root folder of the PHP installation.
>
> I have added the bin folder of the postgresql installation to the Windows system search path.
> "
>
> I would say add the lib/ of the Postgres install to the search path.
>
>>



--
Adrian Klaver



rob stone-2
Reply | Threaded
Open this post in threaded view
♦
♦
|

Re: PostgreSQl, PHP and IIS

rob stone-2
Hi

On Mon, 2018-09-24 at 10:46 +0100, Mark Williams wrote:
> Hi thanks,
>
> Sadly PHP and IIS isn't the issue. It’s when you bring Postgres into
> the fold that I am getting a problem. But thanks.
>
> Mark
>
>
I'm not a Windows user and no little about setting up Postgres using
IIS, but you might find something useful from users' comments at this
link:-

http://www.php.net/manual/en/pgsql.setup.php


Cheers,
Rob