Bienvenue, Invité
Nom d'utilisateur : Mot de passe :


Before asking for help please read "How to request help" by clicking on that tab above here.

SUJET : gedcom export to zip archive fails

gedcom export to zip archive fails il y a 3 semaines 6 jours #1

  • andi
  • Portrait de andi
  • Hors Ligne
  • New
  • Messages : 3
Hi,

I am trying to export my data to a gedcom file into a zip archive („manage family trees“ or „clipping cart“).
This fails with the following error:
Could not open zip archive at:/tmp/webtrees-zip-ZLgSb1, error: 19 …/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php:86

The web server just writes a „500“ into the access log.

When I search for the file in the filesystem of my Linux server, I find it within a private /tmp folder (systemd) of my Apache web server. But the file is empty (size of 0 bytes).
If I disable the private temp option for httpd within the systemd configuration, the result is the same. The empty file can be found directly under /tmp.

selinux is not enabled.

I‘m running PHP with fpm, so the file is created as the linux User owning the webtrees installation and not the user running the web server. Could that be a problem?

I tried to debug this by editing the file ExportGedcomClient.php where I changed $temp_zip_file to be a file within the data-directory of webtrees (line 108). This seemed to work better, but the resulting zip file on the web server was not complete and the browser only showed a white page instead of letting me saving a zip file to my local disk. But this seems to be another error (or just a wrong way to debug ;) ).

Thanks for your help!

Best regards,
Andreas.

webtrees 2.0.2
LAMP (CentOS 7.7, Apache httpd 2.4.6, PHP 7.3, MariaDB 10.3.22)

The complete error message:
Could not open zip archive at:/tmp/webtrees-zip-ZLgSb1, error: 19 …/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php:86
#0 …/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php(42): League\Flysystem\ZipArchive\ZipArchiveAdapter->openArchive('/tmp/webtrees-z...')
#1 …/app/Http/RequestHandlers/ExportGedcomClient.php(109): League\Flysystem\ZipArchive\ZipArchiveAdapter->__construct('/tmp/webtrees-z...')
#2 …/app/Http/Middleware/WrapHandler.php(83): Fisharebest\Webtrees\Http\RequestHandlers\ExportGedcomClient->handle(Object(Nyholm\Psr7\ServerRequest))
#3 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\WrapHandler->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#4 …/app/Module/HitCountFooterModule.php(154): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#5 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Module\HitCountFooterModule->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#6 …/app/Http/Middleware/AuthManager.php(57): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#7 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\AuthManager->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#8 …/app/Http/Middleware/CheckCsrf.php(75): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#9 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckCsrf->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#10 …/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#11 …/app/Http/Middleware/Router.php(134): Middleland\Dispatcher->dispatch(Object(Nyholm\Psr7\ServerRequest))
#12 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\Router->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#13 …/app/Http/Middleware/BootModules.php(62): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#14 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BootModules->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#15 …/app/Http/Middleware/LoadRoutes.php(76): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#16 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\LoadRoutes->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#17 …/app/Http/Middleware/UseTransaction.php(45): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#18 …/vendor/illuminate/database/Concerns/ManagesTransactions.php(29): Fisharebest\Webtrees\Http\Middleware\UseTransaction::Fisharebest\Webtrees\Http\Middleware\{closure}(Object(Illuminate\Database\MySqlConnection))
#19 …/app/Http/Middleware/UseTransaction.php(46): Illuminate\Database\Connection->transaction(Object(Closure), 3)
#20 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseTransaction->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#21 …/app/Http/Middleware/DoHousekeeping.php(81): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#22 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\DoHousekeeping->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#23 …/app/Http/Middleware/UseTheme.php(70): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#24 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseTheme->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#25 …/app/Http/Middleware/CheckForMaintenanceMode.php(51): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#26 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CheckForMaintenanceMode->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#27 …/app/Http/Middleware/UseLanguage.php(73): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#28 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseLanguage->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#29 …/app/Http/Middleware/UseSession.php(73): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#30 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseSession->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#31 …/app/Http/Middleware/UseFilesystem.php(58): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#32 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseFilesystem->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#33 …/app/Http/Middleware/UseCache.php(74): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#34 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseCache->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#35 …/app/Http/Middleware/UpdateDatabaseSchema.php(58): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#36 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UpdateDatabaseSchema->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#37 …/app/Http/Middleware/UseDebugbar.php(67): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#38 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseDebugbar->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#39 …/app/Http/Middleware/UseDatabase.php(95): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#40 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseDatabase->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#41 …/vendor/middlewares/client-ip/src/ClientIp.php(81): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#42 …/app/Http/Middleware/ClientIp.php(47): Middlewares\ClientIp->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#43 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ClientIp->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#44 …/app/Http/Middleware/HandleExceptions.php(76): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#45 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\HandleExceptions->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#46 …/app/Http/Middleware/BaseUrl.php(77): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#47 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BaseUrl->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#48 …/app/Http/Middleware/ReadConfigIni.php(65): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#49 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ReadConfigIni->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#50 …/app/Http/Middleware/SecurityHeaders.php(47): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#51 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\SecurityHeaders->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#52 …/app/Http/Middleware/EmitResponse.php(57): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#53 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\EmitResponse->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#54 …/app/Http/Middleware/PhpEnvironment.php(49): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#55 …/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\PhpEnvironment->process(Object(Nyholm\Psr7\ServerRequest), Object(Middleland\Dispatcher))
#56 …/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle(Object(Nyholm\Psr7\ServerRequest))
#57 …/index.php(55): Middleland\Dispatcher->dispatch(Object(Nyholm\Psr7\ServerRequest))
#58 {main}
L'administrateur a désactivé l'accès en écriture pour le public.

gedcom export to zip archive fails il y a 3 semaines 5 jours #2

  • fisharebest
  • Portrait de fisharebest
  • Hors Ligne
  • Administrator
  • Messages : 12560
Is /tmp full?

You would be able to create an empty file, but not write anything to it?

> This seemed to work better, but the resulting zip file on the web server was not complete

How big was the file? Did it contain a ZIP header - or an error message.
There is probably lots of information here...
Greg Roach - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser. - fisharebest.webtrees.net
L'administrateur a désactivé l'accès en écriture pour le public.

gedcom export to zip archive fails il y a 3 semaines 5 jours #3

  • andi
  • Portrait de andi
  • Hors Ligne
  • New
  • Messages : 3
Thanks for your reply.

No, there is plenty of space in /tmp.


If I change line 108 of app/Http/RequestHandlers/ExportGedcomClient.php from
$temp_zip_file  = tempnam(sys_get_temp_dir(), 'webtrees-zip-');

to
$temp_zip_file  = tempnam('data/tmp', 'webtrees-zip-');

the same error occurs (0 byte files under data/tmp).

So it seems to be a problem with tempnam().


I created a small test.php (from www.php.net/manual/de/function.tempnam.php):
<?php
$tmpfname = tempnam(sys_get_temp_dir(), "FOO");

$handle = fopen($tmpfname, "w");
fwrite($handle, "schreiben in Temporärdatei");
fclose($handle);
?>

This one works as expected. A file "FOOUpKZIA" is created within the private temp folder of the web server and contains "schreiben in Temporärdatei". Owner is the linux user running the php-script.

So generally tempnam() seems to work on my system.


The second problem:

If I change line 108 to be a fixed name the zip file is created and also "filled".
$temp_zip_file  = 'data/tmp/zipexport.zip';

With no media files included (just the compressed gedcom-file) the browser lets me download the zip archive which contains valid data. The contained gedcom seems to be complete.

If I add media files, the zip archive is created, the .ged file and 7 media files are put into the archive. File size is approximately 70MB. Unzipping the archive directly on the server (with unzip) works like a charm, all 8 files are extracted without error. The browser only shows a white page instead of letting me download the file.

Today I changed "memory_limit = 128M" to "512M" within php.ini. Then I was I able to download the zip archive (367MB), and it seems to contain all required media files.
So this part of the problem seems to be solved (even if I am surprised that the complete zip file has to fit in php memory, but I don't have much experience in php programming).

But the temp file creation/usage does not work correctly (at least in my environment).
Do you have an idea what I can try to fix it?

Thanks!
L'administrateur a désactivé l'accès en écriture pour le public.

gedcom export to zip archive fails il y a 3 semaines 3 jours #4

  • fisharebest
  • Portrait de fisharebest
  • Hors Ligne
  • Administrator
  • Messages : 12560
I don't know what is happening on your system. Sorry.

But note that tempnam() does two things. It generates a unique filename, and it also creates an empty file.

So, this would be a more accurate replacement.

$temp_zip_file = 'data/tmp/zipexport.zip';
touch($temp_zip_file);
Greg Roach - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser. - fisharebest.webtrees.net
L'administrateur a désactivé l'accès en écriture pour le public.

gedcom export to zip archive fails il y a 1 semaine 3 jours #5

  • andi
  • Portrait de andi
  • Hors Ligne
  • New
  • Messages : 3
If I create an empty file as suggested the same error occurs:
Could not open zip archive at:data/tmp/zipexport.zip, error: 19 …/vendor/league/flysystem-ziparchive/src/ZipArchiveAdapter.php:86

I also added a chmod($temp_zip_file, 0777) after touch(), same error. So probably there is no access rights problem.

I tried some other things (without success):
  • updating webtrees to 2.0.3
  • updating php to 7.4.4
  • "cleaning" the php.ini (by using a fresh file from php 7.4)
  • removing fcgi for php from the apache vhost
  • using different mpm-options (worker, event, prefork with and without itk)

It seems as if the Zip-Library has a problem with already existing files, at least on my system.

So I added an "unlink" to the code and everything works fine:
$temp_zip_file  = tempnam(sys_get_temp_dir(), 'webtrees-zip-');
unlink($temp_zip_file);
$zip_adapter    = new ZipArchiveAdapter($temp_zip_file);


I suspect that my workaround does not solve the problem in the right way...
L'administrateur a désactivé l'accès en écriture pour le public.

gedcom export to zip archive fails il y a 1 semaine 1 jour #6

  • fisharebest
  • Portrait de fisharebest
  • Hors Ligne
  • Administrator
  • Messages : 12560
Curiously, I can now reproduce the problem - but I couldn't before.

Fixed.

> It seems as if the Zip-Library has a problem with already existing files, at least on my system.

It uses the ZipArchive::CREATE flag - but not the ZipArchive::OVERWRITE flag.

I guess that on some environments this makes a difference...
Greg Roach - Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser. - fisharebest.webtrees.net
L'administrateur a désactivé l'accès en écriture pour le public.
Propulsé par Kunena