•  » Extensions
  •  » OpenStreetMaps plugin error on activation (v15.3.0)

#1 2025-02-16 23:12:18

Tharius
Member
2020-05-08
22

OpenStreetMaps plugin error on activation (v15.3.0)

Hello/Hi/Greetings,

I recently migrated my Piwigo configuration off of a "cheap, shared host". It is now running under OpenMediaVault using Portainer to manage Docker.

The one plugin I have been unable to get to reactivate is OpenStreetMaps, which is a shame because it is just a fantastic visual piece that I really love.

When the direct port didn't work I uninstalled it and reinstalled it to no avail. I do see my old osm table in the database.

When activating I get "an error has occoured":

2025/02/16 16:56:30 [error] 270#270: *195 FastCGI sent in stderr: "PHP message: PHP Warning:  file_put_contents(./osmmap.php): Failed to open stream: Permission denied in /config/www/plugins/piwigo-openstreetmap/maintain.class.php on line 161; PHP message: PHP Fatal error:  Uncaught  --> Smarty: unable to write file ./osmmap.php <--
  thrown in /config/www/plugins/piwigo-openstreetmap/maintain.class.php on line 164" while reading response header from upstream, client: xxxx, server: _, request: "GET /ws.php?method=pwg.plugins.performAction&action=activate&plugin=piwigo-openstreetmap&pwg_token=xxx&format=json HTTP/1.1", upstream: "fastcgi://xxxx", host: "xxxx", referrer: "xxxx/admin.php?page=plugins"



Both environments were Piwigo 15.3.0, but the PHP versions are different (new host 8.3.15, old host 8.2.27)

The permissions on the files look no different than others in the plugin (or other piwigo) directories, directories are 755 and files 644.

Is this a php version issue or should I look at something else at this point?

Offline

 

#2 2025-02-17 02:10:29

Tharius
Member
2020-05-08
22

Re: OpenStreetMaps plugin error on activation (v15.3.0)

Update:

I fiddled with the file permissions to no avail so I decided to hack at the maintain.class.php

I changed the variable path calculation to a hard coded one and it worked:

define('PHPWG_ROOT_PATH','./');
if (isset(\$_GET['v']) and \$_GET['v'] == 1)
  #include_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap.php');
  include_once( '/config/www/plugins/piwigo-openstreetmap/osmmap.php');
else if (isset(\$_GET['v']) and \$_GET['v'] == 2)
  include_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap2.php');
else if (isset(\$_GET['v']) and \$_GET['v'] == 3)
  include_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap3.php');
else if (isset(\$_GET['v']) and \$_GET['v'] == 4)
  include_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap4.php');
else
  include_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap3.php');
EOF;
      #if (!file_put_contents(PHPWG_ROOT_PATH.'osmmap.php', $c)) {
      if (!file_put_contents('/config/www/plugins/piwigo-openstreetmap/osmmap.php', $c)) {
        $_error_reporting = error_reporting();
        error_reporting($_error_reporting);
        throw new SmartyException("unable to write file " .PHPWG_ROOT_PATH. "osmmap.php");
      }
    }


The clue was from the SmartyException in the log file: "Uncaught  --> Smarty: unable to write file ./osmmap.php <--" but looking at the include path in the include_once statement we'd be referencing "./plugins/piwigo-openstreetmap/osmmap1.php" .... for include_once we assume we're in the piwigo root (which for some reason on this install is www/ instead of / ... e.g. www/plugins and www/config instead of / which might be part of the issue....)


So ... did something in the way I put this into a docker container bork the expected setup? Should I move files? Other thoughts?

Offline

 
  •  » Extensions
  •  » OpenStreetMaps plugin error on activation (v15.3.0)

Board footer

Powered by FluxBB