Hello,

This might be a simple gotcha, but I can't find it. I'm trying to build php-4.0.5 with pgsql support but make keeps failing. I have postgresql-7.1 installed and running (both postgresql-7.1 and postgresql-base-7.1 tarballs). I'm building php for use with apache-2.0.16-beta.

PHP configure line:
CFLAGS="-O6 -mpentium" ./configure --with-apxs2=/usr/local/httpd/bin/apxs --with-openssl --enable-ftp --with-pgsql=shared

I have tried --with-pgsql=/usr/local/pgsql but it made no difference. Besides, /usr/local/pgsql is supposed to be the default. This path is nonetheless the $(PREFIX) of my postgresql install.

Error message:
make[3]: Entering directory /usr/home/users/pasti/tmp/php-4.0.5/ext/pgsql'
/bin/sh /usr/home/users/pasti/tmp/php-4.0.5/libtool --silent --mode=compile gcc -I. -I/usr/home/users/pasti/tmp/php-4.0.5/ext/pgsql -I/usr/home/users/pasti/tmp/php-4.0.5/main -I/usr/home/users/pasti/tmp/php-4.0.5 -I/usr/local/httpd/include -I/usr/home/users/pasti/tmp/php-4.0.5/Zend -I/usr/home/users/pasti/tmp/php-4.0.5/ext/mysql/libmysql -I/usr/home/users/pasti/tmp/php-4.0.5/ext/xml/expat/xmltok -I/usr/home/users/pasti/tmp/php-4.0.5/ext/xml/expat/xmlparse -I/usr/home/users/pasti/tmp/php-4.0.5/TSRM -I/usr/local/pgsql/include -D_REENTRANT -DSUPPORT_UTF8 -DXML_BYTE_ORDER=12 -I../TSRM -DTHREAD=1 -O6 -mpentium -pthread -c pgsql.c && touch pgsql.slo
pgsql.c: In function
notice_handler':
pgsql.c:158: warning: passing arg 1 of php_log_err' discards qualifiers from pointer target type
pgsql.c: In function
rollback_transactions':
pgsql.c:167: pgsql_globals' undeclared (first use in this function)
pgsql.c:167: (Each undeclared identifier is reported only once
pgsql.c:167: for each function it appears in.)
make[3]: *** [pgsql.slo] Error 1
make[3]: Leaving directory
/usr/home/users/pasti/tmp/php-4.0.5/ext/pgsql'
make[2]: [all-recursive] Error 1
make[2]: Leaving directory /usr/home/users/pasti/tmp/php-4.0.5/ext/pgsql'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory
/usr/home/users/pasti/tmp/php-4.0.5/ext'
make:
[all-recursive] Error 1

Could you help me out with this? I've tried to overcome this error for several hours now, reading all the docs I can get my hands on.. no luck.

Thanks in advance,
Mikko

    Ditto 100%. I've been without PHP since upgrading from 7.0.3 to 7.1. I also have tried various permutations of configuration options and 7.1.1 too, with no luck.

      Don't know if you tried this yet but it worked for me.

      PHP 4 and PostgreSQL 7.1
      Because of differences in the way PostgreSQL 7.1 has some of it's files placed compared to previous versions, PHP 4 won't compile without making a simple change to a file.

      Before compiling PHP you need to edit the file ext/pgsql/php_pgsql.h in the PHP 4 source code and change the line where it refers to <postgres.h>, to be <postgres_fe.h>

      GoodLuck!

        I should have mentioned I tried that already with 4.0.4. Am I wrong in thinking that fix doesn't apply to 4.0.5? Have you yourself managed to get 7.1 and 4.0.x working together? On what platform? With which web server? With what config options? I've failed to get Apache 1.3 + "shared" PHP 4.0.3,4,5 on Solaris, Linux and Win32 to talk to PostgreSQL 7.1 and 7.1.1 running on Solaris or Linux. Thanks.

          The file doesn't contain reference to postgres.h or postgres_fe.h. I tried to add one but it made no difference.

            I have gotten both pgsql 7.1 and PHP 4.0.5 up and running no problem.

            try doing a make clean in the php directory and then make to see if that works.

              That's encouraging, thanks Scott. Are you using Apache? Did you build as a shared module? My problem manifests itself as PHP complaints that its pg_ functions are undefined. Mikko, was your problem same, or a failure to build altogether?

                Okay, here is a configuration i installed this morning on Redhat Linux 6.0
                kernel 2.2.5-15 but i've also installed successfully on 7.0

                1. installed mysql with normal config options

                2. installed postgresql 7.1

                ./configure --prefix=/usr/local/pgsql --enable-syslog
                gmake
                gmake install

                1. configure apache_1.3.19
                  ./configure --prefix=/usr/local/apache

                4.configure and install php.4.0.5
                Sorry,there was no need to change the line <postgres.h>, to be <postgres_fe.h>
                in version php4.0.5

                this path ../apache_1.3.19 is the directory where apache was unzipped

                ./configure --with-apache../apache_1.3.19 --with-mysql=/usr/local/mysql
                --with-pgsql=/usr/local/pgsql --enable-ftp --enable-sockets
                make
                make install
                cp php.ini-dist /usr/local/lib/php.ini

                1. configure and make apache
                  ./configure --prefix=/usr/local/apache
                  --activate-module=src/modules/php4/libphp4.a --enable-module=php4
                  make
                  make install

                Hope this helps
                BTW what version of linux are you installing on?

                  Thanks, Sam. I managed to install 7.1.1 and 4.0.5 last night myself on Redhat 7.1, but I wasn't sure which of several changes to my procedure had done the trick. I thought maybe it was using gmake for everything, but I see you have used make on Apache and PHP. What we HAVE done similarly is to avoid "=shared" on --with-pgsql.

                    Sorry for taking so long in answering back, I've been a bit busy this week.

                    Anyway, the way I build php/postgresql/apache:

                    cd /usr/local/src
                    tar -xvzf /root/apache_1.3.19.tar.gz
                    tar -xvzf /root/php-4.0.5.tar.gz
                    tar -xvzf /root/postgresql-7.1.tar.gz

                    cd apache_1.3.19
                    ./configure --prefix=/www \
                    --enable-module=most \
                    --enable-shared=max
                    make
                    make install

                    cd ../postgresql-7.1
                    ./configure --enable-odbc \
                    --with-max-backends=1024 \
                    --with-tcl
                    make
                    make install

                    cd ../php-4.0.5
                    ./configure --with-apxs=/www/bin/apxs \
                    --with-pgsql
                    make
                    make install

                    That should all work. Note that I install postgresql to the default /usr/local/pgsql directory here. If you used a --prefix=/db switch for postgres, then you need to do a --with-pgsql=/db for php to tell it where to find the pgsql installed directory. Note that unlike some other apps, php wants the directory postgresql was installed to, not from.

                      Write a Reply...