Piwigo / piwigo-openstreetmap

OpenStreetMap integration for Piwigo
http://piwigo.org/ext/extension_view.php?eid=701
GNU General Public License v3.0
35 stars 35 forks source link

Doesn't work, give file not found error. #48

Closed florihupf closed 9 years ago

florihupf commented 9 years ago

Hi there,

I just cloned the plugin into the plugins folder. I activated it and saved settings.

When I click on the world map or the OpenStreetMap entry, I get:

Not Found

The requested URL /piwigo/osmmap.php was not found on this server.

Apache/2.2.22 (Debian) Server at www.mydomain.org Port 80

florihupf commented 9 years ago

If I manually create a file in the root piwigo folder named osmmap.php containing:

<?php define('PHPWG_ROOT_PATH','./'); include_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap2.php'); ?>

it works.

Looks like the file is not installed correctly. Or the instruction manual doesn't point it out.

xbgmsharp commented 9 years ago

You need to have the correct permission set on the PWG root directory. The plugin create a file own by the webserver on the PWG root directory. You can check this file to have the latest version. https://github.com/xbgmsharp/piwigo-openstreetmap/blob/master/maintain.inc.php#L117

florihupf commented 9 years ago

Hmmm,

there should either be a note about this in the README / Wiki page or even better would be an error message when activating the plugin.

This way it is a frustrating user experience.

:)

richardpickett commented 1 year ago

Don't anyone follow @xbgmsharp's advice.

Setting the website files and/or directories permissions so the web server can write program files is knowingly creating a huge security hole on your server.

Have you read where piwigo users had their sites hacked, photos defaced/stolen, etc? Yeah, @xbgmsharp's advice can create that kind of problem for you.

Very foolish indeed.

For everyone else who isn't a programmer and can't figure out why this plugin doesn't display the map when you click on it, this is what you need to do:

In the application folder on your piwigo site (it will have files like about.php, action.php, admin directory, admin.php, comments.php, etc), create a file named osmmap.php and put the following contents:

<?php
define( 'PHPWG_ROOT_PATH', './' );
if ( isset( $_GET['v'] ) and 1 == $_GET['v'] ) {
    include_once PHPWG_ROOT_PATH . 'plugins/piwigo-openstreetmap/osmmap.php';
} elseif ( isset( $_GET['v'] ) and 2 == $_GET['v'] ) {
    include_once PHPWG_ROOT_PATH . 'plugins/piwigo-openstreetmap/osmmap2.php';
} elseif ( isset( $_GET['v'] ) and 3 == $_GET['v'] ) {
    include_once PHPWG_ROOT_PATH . 'plugins/piwigo-openstreetmap/osmmap3.php';
} elseif ( isset( $_GET['v'] ) and 4 == $_GET['v'] ) {
    include_once PHPWG_ROOT_PATH . 'plugins/piwigo-openstreetmap/osmmap4.php';
} else {
    include_once PHPWG_ROOT_PATH . 'plugins/piwigo-openstreetmap/osmmap3.php';
}

?>

Then set the file's owner, group, and permissions to allow the web server user to read from the file, but not be able to write to it. Since I don't know what user your individual sites run as, I can't tell you the correct commands for your site.