+ Responder ao Tópico



  1. #1
    furazoio
    Visitante

    Padrão php com suporte a postgresql

    Fala pessoal,

    Eu preciso recompilar o php com suporte a postgresql, um servidor red hat 7.2, estou utilizando o phpize pra recompilar.

    Esse script em pear "phpize", utiliza o config.m4 do respectivo módulo que se quer instalar, no caso o postgre ( /usr/local/include/php/ext/pgsql/ ), procurei na net este arquivo config.m4 do postgresql, só que está dando erro de sintaxe.

    [root@myserver pgsql]# phpize
    You should update your `aclocal.m4' by running aclocal.
    Configuring for:
    PHP Api Version: 20020918
    Zend Module Api No: 20020429
    Zend Extension Api No: 20021010
    [root@myserver pgsql]# ./configure --with-config-file-path=/etc --enable-ftp --enable-bcmath --disable-debug --enable-bcmath --with-pear --enable-mbstring --enable-ftp --with-calendar=shared --enable-memory-limit --enable-magic-quotes --enable-wddx --with-apache=../apache_1.3.33 --with-mysql=/usr/local/mysql --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-imap=/usr --with-kerberos --with-ttf --with-freetype-dir=/usr --with-curl=/usr --with-mhash=/usr/local --with-mcrypt=/usr/local --with-pgsql=/var/lib/pgsql
    loading cache ./config.cache
    checking host system type... i686-pc-linux-gnu
    checking for gcc... gcc
    checking whether the C compiler (gcc ) works... yes
    checking whether the C compiler (gcc ) is a cross-compiler... no
    checking whether we are using GNU C... yes
    checking whether gcc accepts -g... yes
    checking whether gcc and cc understand -c and -o together... yes
    checking if compiler supports -R... no
    checking if compiler supports -Wl,-rpath,... yes
    checking for PHP prefix... /usr/local
    checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM
    checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20020429
    checking for re2c... exit 0;
    checking for gawk... gawk
    diff: context length specified twice
    ./configure: ---: command not found
    ./configure: +++: command not found
    ./configure: @@: command not found
    ./configure: -+: command not found
    : command not found
    : command not found
    checking for PostgreSQL support... yes, shared
    : command not found
    '/configure: line 1334: syntax error near unexpected token `pg_config])
    '/configure: line 1334: `+ base install directory or the path to pg_config])


    É neste trecho:
    PHP_ARG_WITH(pgsql,for PostgreSQL support,
    [ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL
    - base install directory, defaults to /usr/local/pgsql.])
    + base install directory or the path to pg_config])

    Eu não sei como alterar para o diretório do postgresql, e ficar com a sintaxe correta.

    O postgresql está instalado em /var/lib/pgsql

    Se alguém puder ajudar

    []'s

  2. #2
    bouncer
    Visitante

    Padrão pegaai

    PHP com suporte a PostgreSQL



    Depois de fazer a instalação do PostgreSQL (www.postgresql.org), você deve recompilar/instalar o PHP com a flag --with-pgsql, que é responsável pela construção dos módulos pgsql.

    Exemplo:

    --with-pgsql=shared,/usr/local/pgsql

    Note que /usr/local/pgsql deve ser substituído pelo local onde foi instalado seu PostgreSQL.

    Não tem segredo, é só recompilar o PHP com esta flag que aparecerá o famoso pgsql.so no diretório de módulos da linguagem.

    Para compilar o PHP a partir de seu código-fonte são necessários três comandos, o ./configure, make e make install. Em meu Slackware 9.1, PHP4 e PostgreSQL 7.4 utilizei a seguinte sintaxe:

    # ./configure --prefix=/usr --disable-static --with-apxs=/usr/sbin/apxs --sysconfdir=/etc --enable-discard-path --with-config-file-path=/etc/apache --enable-safe-mode --with-openssl --enable-bcmath --with-bz2 --with-pic --enable-calendar --enable-ctype --with-gdbm --with-db3 --with-imap-ssl=/tmp/pine4.58/imap/c-client --with-imap=/tmp/pine4.58/imap/c-client --enable-dbase --enable-ftp --with-iconv --with-gd --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png --with-gmp --with-pgsql=shared,/usr/local/pgsql --with-xml=shared,/usr --with-gettext=shared,/usr --with-mm=/usr --enable-trans-sid --enable-shmop --enable-sockets --with-regex=php --enable-sysvsem --enable-sysvshm --enable-yp --enable-memory-limit --with-tsrm-pthreads --enable-shared --disable-debug --with-zlib=/usr
    # make
    # make install

    Para fazer um teste, crie uma página na pasta /var/www/htdocs/ com o nome phpinfo.php por exemplo:


    // phpinfo.php
    // -----------
    phpinfo();
    ?>

    Agora abra a seguinte URL em seu browser:

    http://127.0.0.1/phpinfo.php

    e procure pelo suporte ao PostgreSQL, que deverá ser algo como:


    +------------------------------------------------+
    | pgsql |
    +------------------------------------------------+
    | PostgreSQL Support | enabled |
    +------------------------------------------------+
    | PostgreSQL(libpq) Version | 7.4 |
    | Multibyte character support | enabled |
    | SSL support | disabled |
    | Active Persistent Links | 0 |
    | Active Links | 0 |
    +------------------------------------------------+