This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

nominatim: Failed opening required ‘CONST_LibDir/init-website.php’ after installation

0

Hi. I followed the installation instructions with a fresh debian 11. php version is 7.4.21. Here is my apache configuration:

<VirtualHost *:80>
    ServerName geo.domain.tld

    <Directory "/usr/local/lib/nominatim/lib-php/website/">
        Options FollowSymLinks MultiViews
        AddType text/html   .php
        DirectoryIndex search.php
        Require all granted
    </Directory>

    DocumentRoot /usr/local/lib/nominatim/lib-php/website/
</VirtualHost>

Here is the error log generated when trying to access the domain:

[Thu Aug 19 14:26:42.482410 2021] [php7:warn] [pid 438204] [client ::1:34376] PHP Warning:  Use of undefined constant CONST_LibDir - assumed 'CONST_LibDir' (this will throw an Error in a future version of PHP) in /usr/local/lib/nominatim/lib-php/website/search.php on line 3
[Thu Aug 19 14:26:42.482778 2021] [php7:warn] [pid 438204] [client ::1:34376] PHP Warning:  require_once(CONST_LibDir/init-website.php): failed to open stream: No such file or directory in /usr/local/lib/nominatim/lib-php/website/search.php on line 3
[Thu Aug 19 14:26:42.482792 2021] [php7:error] [pid 438204] [client ::1:34376] PHP Fatal error:  require_once(): Failed opening required 'CONST_LibDir/init-website.php' (include_path='.:/usr/share/php') in /usr/local/lib/nominatim/lib-php/website/search.php on line 3

Is there something wrong with my installation?

asked 19 Aug '21, 13:37

azmeuk's gravatar image

azmeuk
11112
accept rate: 0%


One Answer:

0

In the Apache configuration you need to use your project directory, e.g. /srv/nominatim (see https://www.nominatim.org/release-docs/3.7.2/admin/Deployment/#nominatim-with-apache). In previous Nominatim versions that was called the "build" directory. It was created during the Nominatim setup already.

If you can't find website/*.php files in the project directory try running

nominatim refresh --website

in the project directory.

The website/*.php files in the project directory have various @define('CONST_... lines near the top, the files in /usr/local/lib/nominatim/lib-php/website/ don't and the nominatim refresh adds those lines.

answered 19 Aug '21, 17:56

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Source code available on GitHub .