Last modified: 2014-08-31 03:10:48 UTC
After running: php -c "${HOME}/php.ini" maintenance/install.php --dbtype="postgres" --dbname=${db} \ --dbuser=wikiuser --dbpass=${pass} \ --installdbuser=*someuser* --installdbpass=*somepassword* \ --server http://tools.wikimedia.pl --scriptpath "${script}" \ --showexceptions=true --pass test postgrestest WikiAdmin a wiki installs fine, but the first invocation of /w/index.php gives: (Cannot contact the database server: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running locally and accepting connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"?) Backtrace: #0 w/includes/db/Database.php(822): DatabasePostgres->open('', 'wikiuser', '*pass*', '*database*') #1 w/includes/db/Database.php(919): DatabaseBase->__construct(Array) #2 w/includes/db/LoadBalancer.php(717): DatabaseBase::factory('postgres', Array) #3 w/includes/db/LoadBalancer.php(591): LoadBalancer->reallyOpenConnection(Array, false) #4 w/includes/db/LoadBalancer.php(471): LoadBalancer->openConnection(0, false) #5 w/includes/GlobalFunctions.php(3618): LoadBalancer->getConnection(-1, Array, false) #6 w/includes/page/WikiPage.php(379): wfGetDB(-1) #7 w/includes/page/WikiPage.php(462): WikiPage->loadPageData() #8 w/includes/page/WikiPage.php(515): WikiPage->exists() #9 w/includes/page/WikiPage.php(222): WikiPage->getContentModel() #10 w/includes/page/WikiPage.php(208): WikiPage->getContentHandler() #11 w/includes/actions/Action.php(96): WikiPage->getActionOverrides() #12 w/includes/actions/Action.php(149): Action::factory('view', Object(WikiPage), Object(RequestContext)) #13 w/includes/MediaWiki.php(164): Action::getActionName(Object(RequestContext)) #14 w/includes/MediaWiki.php(533): MediaWiki->getAction() #15 w/includes/MediaWiki.php(460): MediaWiki->main() #16 w/index.php(46): MediaWiki->run() #17 {main} LocalSettings.php include: $wgDBtype = "postgres"; $wgDBserver = ""; $wgDBname = "*dbname*"; Running the installer with explicit --dbserver=localhost php -c "${HOME}/php.ini" maintenance/install.php --dbtype="postgres" --dbname=${db} \ --dbuser=wikiuser --dbpass=${pass} \ --dbserver=localhost \ --installdbuser=*user* --installdbpass=*pass* \ --server http://tools.wikimedia.pl --scriptpath "${script}" \ --showexceptions=true --pass test postgrestest WikiAdmin Seems to create LocalSettings.php with Now LocalSettings.php include: $wgDBtype = "postgres"; $wgDBserver = "localhost"; $wgDBname = "*dbname*"; which indicates this is probably another intstance of bug 69291
... I mean "another instance of bug 69281"
I agree that bugs 69281 and 70233 are relevant here. Based on the error message, it is trying to connect to postgres through a local unix socket rather than a TCP socket, which is certainly to do possible. But web servers are often prevented from doing that by selinux, private Temp Files, or some other security feature. Rather than trying to fight those invisible train wrecks, I just don't even attempt to use local unix sockets. (Which you weren't attempting to do, but only did accidentally through lack of defaults.) To clarify, once you filled in "localhost", it then worked, right?
Yes, it worked but... I am not using selinux (only FreeBSD) and socket-only connection works from the commandline. I just reconfigured PostgreSQL to listen only on the socket connection and see how it works.
So, with I61d5f262e60722bc08201b40b61a298d8af42223 (patch for bug 70030) and I0ded13f9f7a2ab93a070224e7448cda34ac83df1 (patch for bug 70223) the CLI installer runs just fine with empty value for the database servers and finishes its work generating LocalSettings.php with $wgDBserver = ""; WebInstaller fails with an error, however: DB connection error: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission denied Is the server running locally and accepting connections on Unix domain socket "/run/postgresql/.s.PGSQL.5432"
Ah, nevermind... this was because webserver could not access the socket (directory permissions). I have changed the permissions and now everything works fine.