Piwigo / Piwigo-BatchDownloader

Allows users to download pictures sets from your Piwigo gallery in a ZIP file. Compatible with User Collections.
http://piwigo.org/ext/extension_view.php?eid=616
GNU General Public License v2.0
9 stars 12 forks source link

Downloading zip file result in error 500 #46

Closed robinofe closed 1 year ago

robinofe commented 1 year ago

After clicking the link to the compressed file, I get an error 500 message. In the the logs i found the following entries:

2023/07/05 20:40:43 [error] 339#339: *629 FastCGI sent in stderr: "PHP message: PHP Warning: include(../../include/common.inc.php): Failed to open stream: No such file or directory in /config/www/plugins/BatchDownloader/download.php on line 3PHP message: PHP Warning: include(): Failed opening '../../include/common.inc.php' for inclusion (include_path='.:/usr/share/php81') in /config/www/plugins/BatchDownloader/download.php on line 3PHP message: PHP Fatal error: Uncaught Error: Call to undefined function check_status() in /config/www/plugins/BatchDownloader/download.php:5

Piwigo Version: 13.7.0 Batch Downloader: 13.a php: 8.1

no other plugins installed

I run Piwigo on a Docker on unraid. I also installed a second instance with the same result. I have this problem since the Version update with php 8.1.

Help would be really appreciated,

brummbrum commented 1 year ago

same problem for me. Edge Browser throws error 500, Firefox just a blank page. The zip files are actually created and reside in the corresponding folder on the server, however the browser cannot show them.

I am using the linuxserver.io Docker version with: Piwigo Version: 13.8.0 Batch Downloader: 13.a PHP: 8.1.22

brummbrum commented 1 year ago

error messages from nginx suggest that the problem is somewhere in download.php not finding the correct path to Piwigo's include folder inside of the Docker container (based of PHPWG_ROOT_PATH).

Challenge: the plugin's php code (i.e. download.php) resides OUTSIDE of the Docker container but it references folders INSIDE the Docker container which come natively with Piwigo (e.g. include/common.inc.php) and OUTSIDE of the Docker container (i.e. the download-archive folder).

Looks like these type of plugins cannot work well with containers,,,,?

brummbrum commented 1 year ago

Ok, so I found a solution. The problem is indeed the way paths are handled in Piwigo / Extensions when the server resides in a Docker Container and the plugins etc are mounted outside (which they obviously should). The solution is to replace: define('PHPWG_ROOT_PATH', '../../'); with an absolute path $webRoot = $_SERVER['DOCUMENT_ROOT']; $webRootPath = $webRoot.'/'; define('PHPWG_ROOT_PATH', $webRootPath); For this plugin this needs to be done in download.php

robinofe commented 1 year ago

Thanks!!

Ok, so I found a solution. The problem is indeed the way paths are handled in Piwigo / Extensions when the server resides in a Docker Container and the plugins etc are mounted outside (which they obviously should). The solution is to replace: define('PHPWG_ROOT_PATH', '../../'); with an absolute path $webRoot = $_SERVER['DOCUMENT_ROOT']; $webRootPath = $webRoot.'/'; define('PHPWG_ROOT_PATH', $webRootPath); For this plugin this needs to be done in download.php

Thanks a lot- that is it! hope this helps someone else too!!