[isf-wifidog] postgres sql authentication via install.php script
Michael Way
michael.j.way at gmail.com
Mar 18 Mar 17:15:25 EDT 2008
I've solved it. Simply put, I forgot to disable selinux (or modify the
setting if you prefer).
Sorry for the useless post.
-mike
On Tue, Mar 18, 2008 at 3:45 PM, Michael Way <michael.j.way at gmail.com> wrote:
> As the subject says, I'm having an issue with the installation script not
> being able to communicate with the postgresql server. It seems to me that
> the script isn't transmitting the correct information to the server.
>
> some background first:
> OS: Linux Fedora Core 8 i386 (with all of the latest patches installed
> as of today)
> psql (PostgreSQL) 8.2.6
> PHP 5.2.4 (cli) (built: Oct 16 2007 09:13:35)
>
> Postgres is set up with the wifidog account and database and appears functional:
>
> [wifidog at test1 ~]$ psql -l
> List of databases
> Name | Owner | Encoding
> -----------+----------+----------
> postgres | postgres | UTF8
> template0 | postgres | UTF8
> template1 | postgres | UTF8
> wifidog | wifidog | UTF8
> (4 rows)
>
> To make sure the password is what it should be I did this:
> [wifidog at test1 wifidog]$ psql
> wifidog=> ALTER USER wifidog WITH PASSWORD 'wifidogtest';
> wifidog=> \q
>
> Thus far the install.php script runs fine (in my firefox browser). I
> get through all pages just fine *until*
> the "Database Access Configuration" page with:
> Host: localhost
> DB name: wifidog
> Username: wifidog
> Password: wifidogtest
>
> I click "next" and on the next page I get "Unable to connect to database"...
>
> Although I can connect to the database on the command line fine:
> [wifidog at test1 ~]$ psql -h localhost -U wifidog -d wifidog
> Welcome to psql 8.2.6, the PostgreSQL interactive terminal.
> ...
>
> If I check the web logs I find two things of interest from the last
> php page I clicked "next" on:
>
> [Tue Mar 18 14:27:35 2008] [error] [client 127.0.0.1] PHP Notice: Use
> of undefined constant posix_getpwuid - assumed 'posix_getpwuid' in
> /var/www/html/wifidog-auth/wifidog/install.php on line 425, referer:
> http://127.0.0.1/install.php
>
> and
>
> [Tue Mar 18 14:31:44 2008] [error] [client 127.0.0.1] PHP Warning:
> pg_connect() [<a href='function.pg-connect'>function.pg-connect</a>]:
> Unable to connect to PostgreSQL server: could not connect to server:
> Permission denied\n\tIs the server running on host
> "localhost" and accepting\n\tTCP/IP connections on port
> 5432? in /var/www/html/wifidog-auth/wifidog/install.php on line 550,
> referer: http://127.0.0.1/install.php
>
> I wrote a little php script to see if the values I know to be true will work:
> <?php
> $ptr_connexion = pg_connect("host=localhost dbname=wifidog user=wifidog password
> =wifidogtest");
> if ($ptr_connexion == TRUE) {
> print "Success!\n";
> }
> else {
> print "NO!\n";
> }
>
> and it appears to return "Success!"
>
> Finally, I thought I would show off the bottom of my completely
> unsecured pg_hba.conf file so you know everything is open:
> # TYPE DATABASE USER CIDR-ADDRESS METHOD
> local all all trust all
> # IPv4 local connections:
> host all all 127.0.0.1/32 trust all
> host all all 192.168.0.0/16 trust all
>
> and my postgresql.conf relevant lines:
> listen_addresses = '*' # what IP address(es) to listen on;
> port = 5432 # (change requires restart)
>
> I also tried with password encryption on and off (why not? nothing else works).
>
> I was even able to connect to the server from a remote machine.
>
> It seems to me that the install.php script isnt' getting the correct
> information about the database
> from what's been inputted in the script and what shows up on the last
> viable install.php web screen (whose values
> I gave above).
>
> I'm not a php expert, but have set up postgresql and mysql on a
> variety of machines
> and I'm an old unix lackey. Any ideas would be greatly appreciated.
> Sorry for the long email...
>
> cheers,
> mike
>
Plus d'informations sur la liste de diffusion WiFiDog