> Help! I was trying to make an installation of PHP 5.1.2 + Apache
> 2.0.55 + PostgreSQL 8.1 on Windows 2003 Server, and I'm stuck. I
> got PHP to work with Apache quite smoothly, so did I marry PHP
> with PostgreSQL - scripts connecting to the database work fine
> from windows command line, except that the following code:
>
> if (extension_loaded("php_pgsql")) {
> echo "PGSQL loaded!";
> }
>
> returns no message. Still database queries work fine. Trouble
> starts
> when I try to open a page in my browser - then I get an error
> message like this:
>
> Error: call to udefined function pg_connect()...
>
> I changed the php.ini file a billion times, trying to figure out
> what to set in the "extension_dir" and "extension=php_pgsql.dll"
> lines, and I tried at least as many times to change apache's
> httpd.conf file so that the php module is loaded properly. And it
> is, as far as I'm concerned - the phpinfo() page shows without a
> problem. One peculiar thing about it is that in the "Loaded
> modules" section (don't remember the exact name) there's
> absolutely no sign of the pgsql module.
>>you could change the first check to:
>>if (!function_exists('pg_connect')) {
>> die("no pg_connect");
>>}
I did. I got the message "no pg_connect", as You had probably
expected...
>>What does:
>>
>>print_r(get_loaded_extensions());
>>
>>show?
>>
>>Anything regarding pgsql?
Here's the output from both php4 and php5 on both Apache 1.3.45 and
2.0.55:
Array ( [0] => standard [1] => bcmath [2] => calendar [3] => ctype
[4] => com [5] => ftp [6] => mysql [7] => odbc [8] => overload [9]
=> pcre [10] => session [11] => tokenizer [12] => xml [13] => wddx
[14] => zlib [15] => apache )
Actually, it used to be like what's written above, but suddenly it
changed to this and is still like it, no matter what I do:
Array ( [0] => bcmath [1] => calendar [2] => com_dotnet [3] =>
ctype [4] => date [5] => ftp [6] => hash [7] => iconv [8] => odbc
[9] => pcre [10] => Reflection [11] => session [12] => libxml [13]
=> standard [14] => tokenizer [15] => zlib [16] => SimpleXML [17]
=> dom [18] => SPL [19] => wddx [20] => xml [21] => xmlreader [22]
=> xmlwriter [23] => apache2handler )
>>Does your server keep logs? Maybe something in there will give you
>>some ideas about what's going on..
Inside error.log I found the following line (a number of times,
probably because I was often changing httpd.conf and restarting the
server):
PHP Warning: PHP Startup: Unable to load dynamic
library './ext/php_pgsql.dll' - Unable to locate specified module
in Unknown on line 0
(This might not be the exact message as I was translating the part
after "-" from my native language, which is Polish.
By the way, here's some more detailed info about my installation:
PHP4 directory: C:\PHP4 (extensions in C:\PHP4\extensions)
PHP5 directory: C:\PHP5 (extensions in C:\PHP5\ext)
Apache 1.3.34 directory: C:\Program Files\Apache Group\Apache
Apache 2.0.55 directory: C:\Program Files\Apache Group\Apache2
The following comments will relate to PHP5 + Apache2 configuration
files. I tried the same things with other combinations of php and
apache versions with the same result (i.e. no result). All of these
lines are uncommented.
php.ini (located in C:\PHP5\php.ini)
doc_root=
user_dir=
extension_dir="C:/PHP5/ext/" (also tried "./ext", "C:\PHP5\ext")
...
extension=php_pgsql.dll
httpd.conf (located in ...Apache2\conf\httpd.conf)
UserDir "D:/WWW/*"
DirectoryIndex index.php index.htm index.html index.html.var
LoadModule php5_module "C:\PHP5\php5apache2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir "C:\PHP5\"
--
Nie przychodz! Nie przyjezdzaj! Nie dzwon! Zamow ogloszenie drobne do "Gazety Wyborczej" przez internet wchodzac na
http://www.aaaby.pl/wyborczai wygraj nawet 10.000 zl!