Nominatim installation problem

i have following reference from http://open.mapquestapi.com/npi/ to install nominatim pre index.

but i have problem when execute command :

sudo ./setup.php --create-db --create-functions --create-minimal-tables

error logs like bellow



src/nominatim/utils$ sudo ./setup.php --create-db --create-functions --create-minimal-tables
Create DB
createdb: could not connect to database postgres: FATAL:  role "root" does not exist
Create DB (2)
string(19) "pgsql://@/nominatim"
object(DB_Error)#4 (8) {
  ["error_message_prefix"]=>
  string(0) ""
  ["mode"]=>
  int(1)
  ["level"]=>
  int(1024)
  ["code"]=>
  int(-25)
  ["message"]=>
  string(29) "DB Error: extension not found"
  ["userinfo"]=>
  string(55) " [DB Error: extension not found] ** pgsql://@/nominatim"
  ["backtrace"]=>
  array(7) {
 ...
 ...
 ...
    array(6) {
      ["file"]=>
      string(40) "/home/user/Map/src/nominatim/lib/db.php"
      ["line"]=>
      int(7)
      ["function"]=>
      string(7) "connect"
      ["class"]=>
      string(2) "DB"
      ["type"]=>
      string(2) "::"
      ["args"]=>
      array(2) {
        [0]=>
        string(19) "pgsql://@/nominatim"
        [1]=>
        bool(false)
      }
    }
    [6]=>
    array(4) {
      ["file"]=>
      string(45) "/home/user/Map/src/nominatim/utils/setup.php"
      ["line"]=>
      int(82)
      ["function"]=>
      string(5) "getDB"
      ["args"]=>
      array(0) {
      }
    }
  }
  ["callback"]=>
  NULL
}
PHP Warning:  log() expects parameter 1 to be double, string given in /home/user/Map/src/nominatim/lib/lib.php on line 6
DB Error: extension not found


anyone could help me ?

Thanks

i have change user as normal user to execute that command, everything working well.
But when i move website/* to my documentRoot Apache2, i cannot access it via browser.

On error log looks :

PHP Fatal error: require_once(): Failed opening required ‘.htlib/init.php’

I check that file, it’s really not found.Where i get that file ?

Thanks

I have change my db to Postgresql 8.4.

Now when i execute command :


../utils/setup.php --create-db --creinimal-tables

i got error like bellow :


../utils/setup.php --create-db --create-functions --create-m
inimal-tables
Create DB
Create DB (2)
PHP Warning:  log() expects parameter 1 to be double, string given in /home/user/Map/src/nominatim/lib/
lib.php on line 6
unable to find /usr/share/postgresql/9.0/contrib/_int.sql


It’s like that script wrong to indentify my postgresql folder.

what should i do to solve this problem ?

Thanks

the script is looking for /usr/share/postgresql/9.0/contrib/_int.sql,
but the path is different with Postgresql 8.4
so you have to change every 9.0 in the script to 8.4

or install Postgres 9.0

HTH,
ajoessen

Yes, i have change that value on setting.php.

i have execute again

…/utils/setup.php --create-db --create-functions --create-minimal-tables

But on end of line of output, i have got warning like bellow .

[output]


INSERT 0 1
INSERT 0 1
INSERT 0 1
...
SET
SET
CREATE TABLE
SET
SET
SET
SET
SET
SET
SET
SET
CREATE TABLE
ALTER TABLE
Functions
PHP Warning:  log() expects parameter 1 to be double, string given in /home/user/Map/src/nominatim/lib/lib.php on line 6
nominatim module not built

i’m running script as user which have role on postgresql but not as postgres. is it problem ?

This is line 6 on lib.php


 function fail($sError, $sUserError = false)
    {
            if (!$sUserError) $sUserError = $sError;
            log('ERROR:'.$sError);  //line 6
            echo $sUserError."\n";
            exit;
    }

I have comment out that function because someone tell me that it’s wrong algortihm.

I have continuing step and now i have on generating website step.

I have execute this script as described in reference: …/setup.php --create-website /var/www/html

NOw i have publish it on http://www.osmosa.net/search But when i access web, i get error on apache log.


[Tue Jan 03 21:27:02 2012] [error] [client 118.137.0.31] PHP Notice:  Undefined index: PATH_INFO in /home/user/Map/src/nominatim/website/search.php on line 95

[Tue Jan 03 21:27:02 2012] [error] [client 118.137.0.31] PHP Notice:  Use of undefined constant CONST_Search_AreaPolygons - assumed 'CONST_Search_AreaPolygons' in /home/user/Map/src/nominatim/lib/template/search-html.php on line 327
i have checked on /home/user/Map/src/nominatim/website/search.php on line 95, i get script bellow :

 $sQuery = (isset($_GET['q'])?trim($_GET['q']):'');
    if (!$sQuery && $_SERVER['PATH_INFO'] && $_SERVER['PATH_INFO'][0] == '/')  /* >> line 95
    {
            $sQuery = substr($_SERVER['PATH_INFO'], 1);

            // reverse order of '/' seperated string
            $aPhrases = explode('/', $sQuery);
            $aPhrases = array_reverse($aPhrases); 
            $sQuery = join(', ',$aPhrases);
    }

Then i check on /home/user/Map/src/nominatim/lib/template/search-html.php line 327.and i get this line one


<?php if (CONST_Search_AreaPolygons) { ?><td style="width:100px;"><input type="checkbox" value="1" name="polygon" <?php if ($bSh$
<td style="text-align:right;">Data: <?php echo $sDataDate; ?></td>
<td style="text-align:right;">
<a href="http://wiki.openstreetmap.org/wiki/Nominatim" target="_blank">Documentation</a> | <a href="http://wiki.openstreetmap.org/wiki/Nominatim/FAQ" 
target="_blank">FAQ</a></td>
<?php }

Then i see on nominatim folder /setting/setting.php and i get that constanta have value :

@define(‘CONST_Search_AreaPolygons_Enabled’, true);

how i can set PATH_INFO which now is undefined ?

i also post that issue on http://help.openstreetmap.org/questions/9702/nominatim-installation-problem

I have import pre-index file with command :


./nominatim -I -F latest.npi.bz2 -T ../settings/partitionedtags.def

then i have generated website for it


../setup.php --create-website /var/www/My_ROOT_Directory

Now i have finished all of my step.So how i can check my configuration running or not ?Because when i try to klik search, not found page appear

Let see on : http://www.osmosa.net/search/

Thanks

I have check manually with

http://www.osmosa.net/search/search.php?q=jakarta&viewbox=-140.89%2C64.68%2C-20.83%2C31.75

I don’t know what’s the error ?
But i get permission denied message.
What should i do ?

Actually table cannot accessed by www-data so it can show on apache2.
Then I have executing psql command to overcome permission denied with command :

grant select on location_property_aux to “www-data”;
grant select on location_property_tiger to “www-data”;

And i configure on setting.php

@define('CONST_Website_BaseURL', '[http://www.osmosa.net/search/](http://www.osmosa.net/search/)');

Now Everything works well :slight_smile:

I have successfull in Nominatim Instlalation,

Now i want to add search box on my main website on www.osmosa.net.
How to get it ? it’s use nominatim too, right ?

I want to embed search box like on www.openstreetmap.org

Any suggesions where i must begin it?

Thanks