Обсуждение: php and postgresql on windows

Поиск
Список
Период
Сортировка

php and postgresql on windows

От
Przemek Kowalczyk
Дата:
I am having trouble making php have postgresql support.  I saw a post
saying that if it is setup correctly you should see a psql entry. in
info.php.  I see no such entry.
My postgresql is setup correctly because I can connect to it, view
tables etc.  I am trying to setup php5, I installed it with apache2
and php itself works.  But I cannot get postgresql part to work.  I
have a simple script that I found when looking up the pg_connect
function but I get Fatal error: Call to undefined function
pg_connect() in F:\Program Files\Apache Group\Apache2\htdocs\index.php
on line 2
I also tried phppgadmin and it also gives me an error saying that
"Your PHP installation does not support PostgreSQL. You need to
recompile PHP using the --with-pgsql configure option."


In my php.ini I have
extension_dir = "./;F:\PHP\ext\"
and I have taken out the semi-colon in
extension=php_pgsql.dll

Is that all that's required to get the pg functions to work?

I tried inserting this dl('php_pgsql.dll'); into my script and still
says undefined function.

Re: php and postgresql on windows

От
Chris
Дата:
Hi,

Does the php_pgsql.dll file exist in the f:\php\ext folder?

Did you restart your webserver after making this change?

Przemek Kowalczyk wrote:
> I am having trouble making php have postgresql support.  I saw a post
> saying that if it is setup correctly you should see a psql entry. in
> info.php.  I see no such entry.
> My postgresql is setup correctly because I can connect to it, view
> tables etc.  I am trying to setup php5, I installed it with apache2
> and php itself works.  But I cannot get postgresql part to work.  I
> have a simple script that I found when looking up the pg_connect
> function but I get Fatal error: Call to undefined function
> pg_connect() in F:\Program Files\Apache Group\Apache2\htdocs\index.php
> on line 2
> I also tried phppgadmin and it also gives me an error saying that
> "Your PHP installation does not support PostgreSQL. You need to
> recompile PHP using the --with-pgsql configure option."
>
>
> In my php.ini I have
> extension_dir = "./;F:\PHP\ext\"
> and I have taken out the semi-colon in
> extension=php_pgsql.dll
>
> Is that all that's required to get the pg functions to work?
>
> I tried inserting this dl('php_pgsql.dll'); into my script and still
> says undefined function.


Re: php and postgresql on windows

От
Przemek Kowalczyk
Дата:
Yes and Yes.

On 03/02/06, Chris <dmagick@gmail.com> wrote:
> Hi,
>
> Does the php_pgsql.dll file exist in the f:\php\ext folder?
>
> Did you restart your webserver after making this change?
>
> Przemek Kowalczyk wrote:
> > I am having trouble making php have postgresql support.  I saw a post
> > saying that if it is setup correctly you should see a psql entry. in
> > info.php.  I see no such entry.
> > My postgresql is setup correctly because I can connect to it, view
> > tables etc.  I am trying to setup php5, I installed it with apache2
> > and php itself works.  But I cannot get postgresql part to work.  I
> > have a simple script that I found when looking up the pg_connect
> > function but I get Fatal error: Call to undefined function
> > pg_connect() in F:\Program Files\Apache Group\Apache2\htdocs\index.php
> > on line 2
> > I also tried phppgadmin and it also gives me an error saying that
> > "Your PHP installation does not support PostgreSQL. You need to
> > recompile PHP using the --with-pgsql configure option."
> >
> >
> > In my php.ini I have
> > extension_dir = "./;F:\PHP\ext\"
> > and I have taken out the semi-colon in
> > extension=php_pgsql.dll
> >
> > Is that all that's required to get the pg functions to work?
> >
> > I tried inserting this dl('php_pgsql.dll'); into my script and still
> > says undefined function.
>
>

Re: php and postgresql on windows

От
Chris
Дата:
Hi,

Try changing this:

extension_dir = "./;F:\PHP\ext\"

to

extension_dir = "./;F:/PHP/ext/"

it could be escaping the quote at the end incorrectly. Long shot ;)

(then restart the webserver).


Przemek Kowalczyk wrote:
> Yes and Yes.
>
> On 03/02/06, Chris <dmagick@gmail.com> wrote:
>
>>Hi,
>>
>>Does the php_pgsql.dll file exist in the f:\php\ext folder?
>>
>>Did you restart your webserver after making this change?
>>
>>Przemek Kowalczyk wrote:
>>
>>>I am having trouble making php have postgresql support.  I saw a post
>>>saying that if it is setup correctly you should see a psql entry. in
>>>info.php.  I see no such entry.
>>>My postgresql is setup correctly because I can connect to it, view
>>>tables etc.  I am trying to setup php5, I installed it with apache2
>>>and php itself works.  But I cannot get postgresql part to work.  I
>>>have a simple script that I found when looking up the pg_connect
>>>function but I get Fatal error: Call to undefined function
>>>pg_connect() in F:\Program Files\Apache Group\Apache2\htdocs\index.php
>>>on line 2
>>>I also tried phppgadmin and it also gives me an error saying that
>>>"Your PHP installation does not support PostgreSQL. You need to
>>>recompile PHP using the --with-pgsql configure option."
>>>
>>>
>>>In my php.ini I have
>>>extension_dir = "./;F:\PHP\ext\"
>>>and I have taken out the semi-colon in
>>>extension=php_pgsql.dll
>>>
>>>Is that all that's required to get the pg functions to work?
>>>
>>>I tried inserting this dl('php_pgsql.dll'); into my script and still
>>>says undefined function.
>>
>>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>


Re: php and postgresql on windows

От
"Randy Moller"
Дата:
Actually, the php_pgsql.dll file does NOT natively install on the windows
CGI distribution. If you installed using the "installer", then download the
zip distribution and extract the dll from the ext folder.

Next, if you haven't already done so, uncomment the extension line on
php.ini, and you should be good to go.

If you installed originally from the zip/tar/rar file, then it should be
there, yes.

Hope this helps.

Randy

-----Original Message-----
From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org]
On Behalf Of Przemek Kowalczyk
Sent: Thursday, February 02, 2006 10:04 PM
To: pgsql-php@postgresql.org
Subject: Re: [PHP] php and postgresql on windows

Yes and Yes.

On 03/02/06, Chris <dmagick@gmail.com> wrote:
> Hi,
>
> Does the php_pgsql.dll file exist in the f:\php\ext folder?
>
> Did you restart your webserver after making this change?
>
> Przemek Kowalczyk wrote:
> > I am having trouble making php have postgresql support.  I saw a post
> > saying that if it is setup correctly you should see a psql entry. in
> > info.php.  I see no such entry.
> > My postgresql is setup correctly because I can connect to it, view
> > tables etc.  I am trying to setup php5, I installed it with apache2
> > and php itself works.  But I cannot get postgresql part to work.  I
> > have a simple script that I found when looking up the pg_connect
> > function but I get Fatal error: Call to undefined function
> > pg_connect() in F:\Program Files\Apache Group\Apache2\htdocs\index.php
> > on line 2
> > I also tried phppgadmin and it also gives me an error saying that
> > "Your PHP installation does not support PostgreSQL. You need to
> > recompile PHP using the --with-pgsql configure option."
> >
> >
> > In my php.ini I have
> > extension_dir = "./;F:\PHP\ext\"
> > and I have taken out the semi-colon in
> > extension=php_pgsql.dll
> >
> > Is that all that's required to get the pg functions to work?
> >
> > I tried inserting this dl('php_pgsql.dll'); into my script and still
> > says undefined function.
>
>

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.0/248 - Release Date: 2/1/2006



Re: php and postgresql on windows

От
Przemek Kowalczyk
Дата:
On 03/02/06, Randy Moller <zoomerz@comcast.net> wrote:
> Actually, the php_pgsql.dll file does NOT natively install on the windows
> CGI distribution. If you installed using the "installer", then download the
> zip distribution and extract the dll from the ext folder.
>
> Next, if you haven't already done so, uncomment the extension line on
> php.ini, and you should be good to go.
>
> If you installed originally from the zip/tar/rar file, then it should be
> there, yes.
>
> Hope this helps.
It does not work.  Does it matter if I install it as cgi binary or
apache module? I tried both.  The php.ini files get read because I can
see the extension_dir changing for example.
I tried uncommenting the mysql dll in php.ini for fun and and I don't
see anything about mysql in phpinfo.php
Could this be because my drive is F instead of c? No that's stupid eh?

Re: php and postgresql on windows

От
Patrick White
Дата:
I had some similar problems getting the postgre library to become
available to PHP.  The issue I was having was that I didn't realise
the order of which the server will look for the php.ini file (I
thought it was simply looking in the PATH directories), such as the
list I will provide for future reference:

    1.PHPIniDir directive (Apache 2 module only)
    2.HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath
    3. The PHPRC environment variable
    4. Directory of PHP (for CLI), or the web server's directory (for
      SAPI modules)
    5. Windows directory (C:\windows or C:\winnt)

My problem was that Apache was set to look in a directory that
contained a completly default php.ini file.

On 2/3/06, Przemek Kowalczyk <przemek.ca@gmail.com> wrote:
> On 03/02/06, Randy Moller <zoomerz@comcast.net> wrote:
> > Actually, the php_pgsql.dll file does NOT natively install on the windows
> > CGI distribution. If you installed using the "installer", then download the
> > zip distribution and extract the dll from the ext folder.
> >
> > Next, if you haven't already done so, uncomment the extension line on
> > php.ini, and you should be good to go.
> >
> > If you installed originally from the zip/tar/rar file, then it should be
> > there, yes.
> >
> > Hope this helps.
> It does not work.  Does it matter if I install it as cgi binary or
> apache module? I tried both.  The php.ini files get read because I can
> see the extension_dir changing for example.
> I tried uncommenting the mysql dll in php.ini for fun and and I don't
> see anything about mysql in phpinfo.php
> Could this be because my drive is F instead of c? No that's stupid eh?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>

Re: php and postgresql on windows

От
Дата:
- Przemek Kowalczyk <przemek.ca@gmail.com> wrote:

> On 03/02/06, Randy Moller <zoomerz@comcast.net>
> wrote:
> > Actually, the php_pgsql.dll file does NOT natively
> install on the windows
> > CGI distribution. If you installed using the
> "installer", then download the
> > zip distribution and extract the dll from the ext
> folder.
> >
> > Next, if you haven't already done so, uncomment
> the extension line on
> > php.ini, and you should be good to go.
> >
> > If you installed originally from the zip/tar/rar
> file, then it should be
> > there, yes.
> >
> > Hope this helps.
> It does not work.  Does it matter if I install it as
> cgi binary or
> apache module? I tried both.  The php.ini files get
> read because I can
> see the extension_dir changing for example.
> I tried uncommenting the mysql dll in php.ini for
> fun and and I don't
> see anything about mysql in phpinfo.php
> Could this be because my drive is F instead of c? No
> that's stupid eh?
>

i have detailed apache2, php5 and postgresql8 winxp
install instructions here:

http://www.geocities.com/operationsengineer1/

since you are mostly set up, you likely can review 99%
of it without doing anything.  if your isntall
deviated from this install, then you can make the
adjustment.

this is for a cgi install.  i think it is sufficient.
i've recommended about 5 or so people to it and not
one has come back with a problem.

in addition, search this mailing list for a similar
problem about within the last few weeks.  someone had
a similar problem and posted the solution with the
last few weeks.

good luck.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: php and postgresql on windows

От
Przemek Kowalczyk
Дата:
Yes I seen that link from another post in the archive :)  I looked
through it already and it didn't  help (although very nice tutorials
for future reference) :(


On 03/02/06, operationsengineer1@yahoo.com
<operationsengineer1@yahoo.com> wrote:
> - Przemek Kowalczyk <przemek.ca@gmail.com> wrote:
>
> > On 03/02/06, Randy Moller <zoomerz@comcast.net>
> > wrote:
> > > Actually, the php_pgsql.dll file does NOT natively
> > install on the windows
> > > CGI distribution. If you installed using the
> > "installer", then download the
> > > zip distribution and extract the dll from the ext
> > folder.
> > >
> > > Next, if you haven't already done so, uncomment
> > the extension line on
> > > php.ini, and you should be good to go.
> > >
> > > If you installed originally from the zip/tar/rar
> > file, then it should be
> > > there, yes.
> > >
> > > Hope this helps.
> > It does not work.  Does it matter if I install it as
> > cgi binary or
> > apache module? I tried both.  The php.ini files get
> > read because I can
> > see the extension_dir changing for example.
> > I tried uncommenting the mysql dll in php.ini for
> > fun and and I don't
> > see anything about mysql in phpinfo.php
> > Could this be because my drive is F instead of c? No
> > that's stupid eh?
> >
>
> i have detailed apache2, php5 and postgresql8 winxp
> install instructions here:
>
> http://www.geocities.com/operationsengineer1/
>
> since you are mostly set up, you likely can review 99%
> of it without doing anything.  if your isntall
> deviated from this install, then you can make the
> adjustment.
>
> this is for a cgi install.  i think it is sufficient.
> i've recommended about 5 or so people to it and not
> one has come back with a problem.
>
> in addition, search this mailing list for a similar
> problem about within the last few weeks.  someone had
> a similar problem and posted the solution with the
> last few weeks.
>
> good luck.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

Re: php and postgresql on windows

От
Дата:
--- Przemek Kowalczyk <przemek.ca@gmail.com> wrote:

> On 03/02/06, Randy Moller <zoomerz@comcast.net>
> wrote:
> > Actually, the php_pgsql.dll file does NOT natively
> install on the windows
> > CGI distribution. If you installed using the
> "installer", then download the
> > zip distribution and extract the dll from the ext
> folder.
> >
> > Next, if you haven't already done so, uncomment
> the extension line on
> > php.ini, and you should be good to go.
> >
> > If you installed originally from the zip/tar/rar
> file, then it should be
> > there, yes.
> >
> > Hope this helps.
> It does not work.  Does it matter if I install it as
> cgi binary or
> apache module? I tried both.  The php.ini files get
> read because I can
> see the extension_dir changing for example.
> I tried uncommenting the mysql dll in php.ini for
> fun and and I don't
> see anything about mysql in phpinfo.php
> Could this be because my drive is F instead of c? No
> that's stupid eh?

as a quick bit of troubleshooting, did you uncomment
the pgsql dll support in php.ini?  i assume so, based
on your comment above, but assuming can be dangerous.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: php and postgresql on windows

От
Дата:
> Yes I seen that link from another post in the
> archive :)  I looked
> through it already and it didn't  help (although
> very nice tutorials
> for future reference) :(
>

IF you have apache (set up and test it) and php set up
correctly then enabling pgsql should just be a matter
of enabling extension=php_pgsql.dll in php.ini.

if that doesn't work, then apache and php aren't set
up right.

did you review the apache and php tutorials i linked
or did you just review the pgsql tutorial?  i'm pretty
sure the tutorials work (the whole thing, from start
to finish) b/c i use my setup 5 days a week ;-)

i do go into detail how to ensure that winxp is able
to see all the files it needs to see in order to
function correctly.

perhaps this problem/solution will solve your issue...


http://us.f333.mail.yahoo.com/ym/ShowLetter?MsgId=1760_1356328_48452_3387_1224_0_21678_2458_4177234282&Idx=7&sbox=Inbox&Search=1&YY=18468&inc=100&order=down&sort=date&pos=0&view=a&head=b&box=%40S%40Search

The problem was finally discovered to be with
phpinidir configuration in httpd.conf. Through command
line it was working fine because php was able to find
php.ini in system directory (C:\windows), but apache
wasn't able to find php.ini and thus didn't knew if
php should use any extensions.

Thanks everyone for the help,
-Abhishek

good luck.


> On 03/02/06, operationsengineer1@yahoo.com
> <operationsengineer1@yahoo.com> wrote:
> > - Przemek Kowalczyk <przemek.ca@gmail.com> wrote:
> >
> > > On 03/02/06, Randy Moller <zoomerz@comcast.net>
> > > wrote:
> > > > Actually, the php_pgsql.dll file does NOT
> natively
> > > install on the windows
> > > > CGI distribution. If you installed using the
> > > "installer", then download the
> > > > zip distribution and extract the dll from the
> ext
> > > folder.
> > > >
> > > > Next, if you haven't already done so,
> uncomment
> > > the extension line on
> > > > php.ini, and you should be good to go.
> > > >
> > > > If you installed originally from the
> zip/tar/rar
> > > file, then it should be
> > > > there, yes.
> > > >
> > > > Hope this helps.
> > > It does not work.  Does it matter if I install
> it as
> > > cgi binary or
> > > apache module? I tried both.  The php.ini files
> get
> > > read because I can
> > > see the extension_dir changing for example.
> > > I tried uncommenting the mysql dll in php.ini
> for
> > > fun and and I don't
> > > see anything about mysql in phpinfo.php
> > > Could this be because my drive is F instead of
> c? No
> > > that's stupid eh?
> > >
> >
> > i have detailed apache2, php5 and postgresql8
> winxp
> > install instructions here:
> >
> > http://www.geocities.com/operationsengineer1/
> >
> > since you are mostly set up, you likely can review
> 99%
> > of it without doing anything.  if your isntall
> > deviated from this install, then you can make the
> > adjustment.
> >
> > this is for a cgi install.  i think it is
> sufficient.
> > i've recommended about 5 or so people to it and
> not
> > one has come back with a problem.
> >
> > in addition, search this mailing list for a
> similar
> > problem about within the last few weeks.  someone
> had
> > a similar problem and posted the solution with the
> > last few weeks.
> >
> > good luck.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Re: php and postgresql on windows

От
Przemek Kowalczyk
Дата:
I SOLVED IT!
The default php.ini has the extension directory like this:
extension_dir = "./"

Now being a noob, I look up a couple lines and see

include_path = ".;c:\php\includes"

so I figure I should add a semi-colon and append my own extension
directory to extension_dir.  But PHP doesn't like that it seems, the
correct way:

extension_dir = "F:\php\ext"

I can't believe you folks didn't see that :-)

Does this mean you can't have multiple paths for extension_dir?

Re: php and postgresql on windows

От
Дата:
> I SOLVED IT!
> The default php.ini has the extension directory like
> this:
> extension_dir = "./"
>
> Now being a noob, I look up a couple lines and see
>
> include_path = ".;c:\php\includes"
>
> so I figure I should add a semi-colon and append my
> own extension
> directory to extension_dir.  But PHP doesn't like
> that it seems, the
> correct way:
>
> extension_dir = "F:\php\ext"
>
> I can't believe you folks didn't see that :-)
>
> Does this mean you can't have multiple paths for
> extension_dir?

that *exact* instruction is included in the PHP5
tutorial that i recommended for review.

i can't believe you didn't find it.  ;-)

i think the idea is to have one extension directory
and then place all your extensions there vs have
multiple extension directories.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com