Fw: [PHP-ES] Error en pg_pconnect()
| From: | Milo - Desarrollo | Date: | Thu, 13 Nov 2003 08:57:48 +0000 |
| Subject: | Fw: [PHP-ES] Error en pg_pconnect() | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-42521@lists.php.net to get a copy of this message | ||
Perdón, creo que he cometido un error de novato, me parece que no se pueden
enviar adjuntos a esta lista, te copio el contenido del fichero:
----------------------------------------------------------------------------
--------------------------------
1. Manual installation
1.1. Prerequisite
You must have a running Unix server, with Apache and Postgresql. You'll
need:
a.. Apache >= 1.3.22
b.. php >= 4.0.5
c.. postgresql >= 7.1.2
d.. mod_auth_pgsql >= 0.9.9-2
and... the SLIM sources:
a.. ftp://ftp.ac-grenoble.fr/slis/slim
1.2. Installation steps
a.. Change your apache configuration (often /etc/httpd/conf/httpd.conf)
a.. Add this two lines at the end of httpd.conf:
Alias /slimg/ /var/www/html/slim/include/themes/
php_value include_path /var/www/html/slim/include
b.. Change the line in <Directory "/var/www/html"> section:
AllowOverride None
to:
AllowOverride All
c.. If you are running apache v1, uncomment the following lines (it's
not necessary since apache v2):
LoadModule auth_pgsql_module modules/mod_auth_pgsql.so
AddModule mod_auth_pgsql.c
b.. In /etc/php.ini, check that file_uploads is set to "On".
c.. In /etc/php.ini, check that register_globals is set to "On"
d.. Check that your postgresql is running with the -i option. You may have
to edit your /etc/rc.d/init.d/postgres and see if you have the following
line with the "-o -i" option:
For RedHat 7.3:
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -o -i -D $PGDATA -p
/usr/bin/postmaster start > /dev/null 2>&1" < /dev/null
For RedHat 9:
su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p
/usr/bin/postmaster -o '-i -p ${PGPORT}' start > /dev/null 2>&1" <
/dev/null
e.. Unpack slim-<version>.tgz into your apache directory.
f.. Make sure that slim/download directory is writeable by apache:
chown -R apache.apache slim/download
chmod -R 700 slim/download
g.. Add a line to clean the tmp dir every night into your crontab:
21 3 * * * /bin/rm -rf /var/www/html/slim/download/tmp/*
h.. Make a postgresql database for slim named "slim" (for example) and a
postgres user "slim" (for example). See the next section Postgresql quick
start example for an example of psql initialization.
i.. Import "slim" database structure from documents/slim.sql under
postgres user slim (see the Postgresql quick start example).
j.. Insert default data in database slim from documents/defvalue.sql under
postgres user slim (see the Postgresql quick start example).
k.. If your new to SLIM, you may also want to load the example database
contained in documents/example.sql.
l.. create .htaccess file in slim root directory:
AuthName "SLIM"
AuthType Basic
Auth_PG_host localhost
Auth_PG_port 5432
Auth_PG_user xxxx
Auth_PG_pwd xxxx
Auth_PG_database xxxx
Auth_PG_pwd_table slim_user
Auth_PG_uid_field login
Auth_PG_pwd_field password
<LIMIT GET POST>
Require valid-user
</LIMIT>
Replace the xxxx with pgsql slim user params.
m.. Put your sql configuration into the files include/config.php and
.htaccess
n.. Run apache (or restart) and use an http browser to connect to slim
with user: admin , and password: slim
o.. Add this line into /etc/mime.types:
text/csv csv
Slim is now installed!
1.3. Postgresql quick start example
From a fresh install:
# su - postgres
$ psql template1
alter user postgres with password 'xxxx';
create user slim with password 'xxxxxxx' createdb nocreateuser;
\q
$ exit
# vi /var/lib/pgsql/data/pg_hba.conf
/* here, change the lines, to secure a bit your install: */
local slim all password
host slim all 127.0.0.1 255.255.255.255 password
local template1 all password
host template1 all 127.0.0.1 255.255.255.255 password
# /etc/rc.d/init.d/postgresql restart
# su - postgres
$ psql -U slim template1
create database slim;
\c slim
\i /var/www/html/slim/documents/slim.sql
\i /var/www/html/slim/documents/defvalue.sql
\i /var/www/html/slim/documents/example.sql
\q
1.4. Patching SLIM, with the CVS snapshot
a.. Untar the archive slim-daily_cvs_snapshot.tgz into a temporary
directory
b.. Don't untar the archive into your working directory right now!
c.. Copy slim/include/utils.php to <your_htdir>/slim/include
d.. Copy slim/scripts/_fix_sequences.php to <your_htdir>/slim/scripts/
e.. Call _fix_sequences.php from your browser:
http://<your_slim_host>/slim/scripts/_fix_sequences.php
(This script will
clean the sequences, and patch the SQL structure of the database.)
f.. Make a backup copy of your working
<your_htdir>/slim/include/config.php
g.. Add and customize the following lines at the end of this backup
config.php
$download_dir = "/var/www/html/slim/download"; // must be writable by httpd
$def_domain = "ac-grenoble.fr";
$mail_admin = "Bruno@ac-grenoble.fr";
$mail_tickets =
"inter-nets@listes.ac-grenoble.fr,bzizou@ac-grenoble.fr";
$mail_from = "slim@ac-grenoble.fr";
h.. Now, you can untar the archive into your working slim directory:
cd <your_htdir>/
tar zxvf /tmp/slim-daily_cvs_snapshot.tgz
i.. Move your backup config.php into <your_htdir>/slim/include/config.php
It's done... in spite you miss the examples that come with a fresh install
of SLIM 1.1. You can watch for them into documents/slim.sql
PS: <your_htdir> is commonly /var/www/html
----------------------------------------------------------------------------
---------------------
Gracias...
----- Original Message -----
From: "Milo - Desarrollo" <milo@e-posa.com>
To: <lista@phpes.com>
Sent: Thursday, November 13, 2003 9:47 AM
Subject: Re: [PHP-ES] Error en pg_pconnect()
> Yo tuve el mismo problema y al final di con la solución, te adjunto el
> fichero que encontré por internet en el que te indican los pasos a seguir
> para que te funcione correctamente el PostGresql.
>
> Por el error que indicas estoy casi seguro que lo que te falta es
modificar
> la linea siguiente en el "/etc/rc.d/init.d/":
> ----------------------------------------------------------
> For RedHat 9:
> su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl -D $PGDATA -p
> /usr/bin/postmaster -o '-i -p ${PGPORT}' start > /dev/null 2>&1" <
> /dev/null
> ----------------------------------------------------------
> Después de cambiar la linea y reiniar el servidor Postgres de nuevo
ejecuta
> (mejor en otra máquina):
> nmap [dirección_ip_del_servidor_postgres]
> Y tendrá que aparecerte que el servidor está escuchando por el puerto
5432.
>
> Pruébalo y ya me contarás...
>
> Gracias...
>
> ----- Original Message -----
> From: "Willy Acuña A." <wacuna@antequera.com.pe>
> To: <lista@phpes.com>
> Sent: Thursday, November 13, 2003 3:04 AM
> Subject: [PHP-ES] Error en pg_pconnect()
>
>
> Hola Lista.
>
> Tengo problemas en conectarme al PostgreSQL, tengo el servicio de
> PostgreSQl levantado e ingresao he creado mi base de datos una tabla y
> ingresado un registro desde la consola con pgsql como detallo abajo; hay
> alguna configuración extra en el PostgreSQL (abajo detallo pg_hba.conf)
> tengo RH9.0,Apache2.0,PHP4.2 y PostgeSQL7.3.
>
> Espero de sus comentarios, gracias.
>
> Error Mostrado.
> Warning: pg_pconnect() unable to connect to PostgreSQL server: No se ha
> podido conectar con el servidor: Conexión rehusada ¿Está el servidor
> en ejecución en el host localhost y acepta conexiónes TCP/IP en el
> puerto 5432? in /var/www/html/pg.php on line 2
>
> Problemas de conexion con la base de datos.
>
>
> Postgresql ejecutando:
> [root@rh9a html]# service postgresql status
> Se está ejecutando postmaster (pid 7388 7387 7385)...
>
> [root@rh9a pgsql]# su postgres
>
> bash-2.05b$ psql waa2k;
>
> waa2k=# SELECT * FROM usuarios;
> dni | nombres
> ----------+------------------------
> 40992654 | Perico de los Palotes
>
>
> Script php:
> <?php
> $conexion = pg_pconnect("host=localhost port=5432 dbname=waa2k");
>
> if (!$conexion) {
> echo "<center>Problemas de conexion con la base de
> datos.</center>";
> exit;
> }
> ?>
>
>
> [root@rh9a data]# tail pg_hba.conf
> #host all all 127.0.0.1 255.255.255.255
> trust
>
> # Using sockets credentials for improved security. Not available
> everywhere,
> # but works on Linux, *BSD (and probably some others)
>
> local all all ident sameuser
> host all all 127.0.0.1 255.255.255.255 trust
> host all all 192.168.101.12 255.255.255.255 trust
> host all all 192.168.101.7 255.255.255.255 trust
> host all all 192.168.101.0 255.255.255.0 trust
>
> tambien he intentado de la siguiente forma: (sin especificar la bd)
> ...
> host all 192.168.101.0 255.255.255.0 trust
> ...
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/2003
>
>
>
> ---------------------------------------------------------------------
> Archivo On-line: http://www.phpes.com/
> via news: news://news.phpes.com/
> Manual PHP en español: http://www.php.net/manual/es/
> Para dar de baja la suscripción, mande un mensaje a:
> lista-unsubscribe@phpes.com
>
> --------------------------------------------------------------------------
--
> ---------
> Este mensaje y los documentos, que en su caso, lleve anexos, pueden
> contener informacion confidencial y afectan exclusivamente a las personas
> a las que va dirigido. Cualquier opinion en el contenida, es exclusiva de
> su autor y no representa necesariamente la opinion de PROCESOS OPERATIVOS
> S.A.
> Si usted no es el destinatario de este mensaje, considerese advertido de
> que lo ha recibido por error y que cualquier uso, difusion o copia estan
> prohibidos legalmente. Si ha recibido este mensaje por error, le rogamos
> que nos lo comunique por la misma via o al telefono 91 537 64 11 y proceda
> a destruirlo inmediatamente.
>
> This email is confidential and intended solely for the use of the
individual
> to whom it is addressed. Any views or opinions presented are solely those
> of the author and do not necessarily represent those of PROCESOS
OPERATIVOS
> S.A.
> If you are not the intended recipient, be advised that you have received
> this email in error and that any use, dissemination, forwarding, printing,
> or copying of this email is strictly prohibited.
> If you have received this email in error please notify it to PROCESOS
> OPERATIVOS S.A
> by telephone on number +34 91 537 64 11
> --------------------------------------------------------------------------
--
> ---------
>
>
>
>
----------------------------------------------------------------------------
----
> ---------------------------------------------------------------------
> Archivo On-line: http://www.phpes.com/
> via news: news://news.phpes.com/
> Manual PHP en espaqol: http://www.php.net/manual/es/
> Para dar de baja la suscripcisn, mande un mensaje a:
> lista-unsubscribe@phpes.com
-------------------------------------------------------------------------------------
Este mensaje y los documentos, que en su caso, lleve anexos, pueden
contener informacion confidencial y afectan exclusivamente a las personas
a las que va dirigido. Cualquier opinion en el contenida, es exclusiva de
su autor y no representa necesariamente la opinion de PROCESOS OPERATIVOS S.A.
Si usted no es el destinatario de este mensaje, considerese advertido de
que lo ha recibido por error y que cualquier uso, difusion o copia estan
prohibidos legalmente. Si ha recibido este mensaje por error, le rogamos
que nos lo comunique por la misma via o al telefono 91 537 64 11 y proceda
a destruirlo inmediatamente.
This email is confidential and intended solely for the use of the individual
to whom it is addressed. Any views or opinions presented are solely those
of the author and do not necessarily represent those of PROCESOS OPERATIVOS S.A.
If you are not the intended recipient, be advised that you have received
this email in error and that any use, dissemination, forwarding, printing,
or copying of this email is strictly prohibited.
If you have received this email in error please notify it to PROCESOS OPERATIVOS S.A
by telephone on number +34 91 537 64 11
-------------------------------------------------------------------------------------