malformed JSON string with piwigo_import_tree.pl #713

Open
opened 2026-10-05 00:13:11 +02:00 by adam · 2 comments
Owner

Hi,

I'm trying to migrate from DAlbum to Piwigo and am currently having this issue with v2.9.1 on 3 different directories. After about 18 photos uploaded, I get this error:

malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "
\nWarning</...") at /home/jsv/piwigo_import_tree.pl line 366.

I was able to upload a few hundred already but still have about 25,000 photos to move over. This program would be great if I can work through the issues.

I'm running Piwigo 2.9.1 on CentOS 7.4 with the stock Apache 2.4.6 and I'm using v1.0 of piwigo_import_tree.pl.

P.S. The --parent_album_id option doesn't seem to be working either.

Please let me know what information I can provide.

Thanks,

-Jeff

Hi, I'm trying to migrate from DAlbum to Piwigo and am currently having this issue with v2.9.1 on 3 different directories. After about 18 photos uploaded, I get this error: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before " \nWarning</...") at /home/jsv/piwigo_import_tree.pl line 366. I was able to upload a few hundred already but still have about 25,000 photos to move over. This program would be great if I can work through the issues. I'm running Piwigo 2.9.1 on CentOS 7.4 with the stock Apache 2.4.6 and I'm using v1.0 of piwigo_import_tree.pl. P.S. The --parent_album_id option doesn't seem to be working either. Please let me know what information I can provide. Thanks, -Jeff <!-- github-sync-id:260142094 -->
Author
Owner

I figured out my own problem. Since the error wasn't providing the full actual error, I found the following errors in my apache logs:

[Mon Sep 25 18:33:31.575799 2017] [:error] [pid 7354] [client 192.168.2.2:42524] PHP Warning: md5_file(): Filename cannot be empty in /.../piwigo/admin/include/functions_upload.inc.php on line 175
[Mon Sep 25 18:33:31.576068 2017] [:error] [pid 7354] [client 192.168.2.2:42524] PHP Warning: getimagesize(): Filename cannot be empty in /.../piwigo/admin/include/functions_upload.inc.php on line 226

That and using the perl debugger to trace the to the actual error turned up that I simply needed to increase "max_file_uploads" in /etc/php.ini. Apparently, the size of the jpg files I was uploading was causing an error but piwigo_import_tree.pl wasn't really reporting it very well.

-Jeff

I figured out my own problem. Since the error wasn't providing the full actual error, I found the following errors in my apache logs: [Mon Sep 25 18:33:31.575799 2017] [:error] [pid 7354] [client 192.168.2.2:42524] PHP Warning: md5_file(): Filename cannot be empty in /.../piwigo/admin/include/functions_upload.inc.php on line 175 [Mon Sep 25 18:33:31.576068 2017] [:error] [pid 7354] [client 192.168.2.2:42524] PHP Warning: getimagesize(): Filename cannot be empty in /.../piwigo/admin/include/functions_upload.inc.php on line 226 That and using the perl debugger to trace the to the actual error turned up that I simply needed to increase "max_file_uploads" in /etc/php.ini. Apparently, the size of the jpg files I was uploading was causing an error but piwigo_import_tree.pl wasn't really reporting it very well. -Jeff <!-- github-comment-id:332059779 -->
Author
Owner

thanks @feretio your answer helped me solve it as well.

to add some more details for non perlists:

running the perl script with the debug flag (-d) starts an interactive debugger:

sudo perl -d piwigo_import_tree.pl --base-url=XXX --user=XXX --password=XXX --directory=XXX

then upon the next halt, pressing c continues until the error. Here the error is printed with more details and a stacktrace:

[album 4] "XXX" upload starts... malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at /usr/local/share/perl/5.26.1/JSON.pm line 187.
 at /usr/local/share/perl/5.26.1/JSON.pm line 187.
	JSON::from_json("<html>\x{d}\x{a}<head><title>413 Request Entity Too Large</title></he"...) called at piwigo_import_tree.pl line 366
	main::add_photo("path", "XXX", "album_id", 4) called at piwigo_import_tree.pl line 445
	main::add_to_piwigo() called at /usr/share/perl/5.26/File/Find.pm line 448
	File::Find::_find_dir(HASH(0x55c49e4556c0), "XXX", 9) called at /usr/share/perl/5.26/File/Find.pm line 236
	File::Find::_find_opt(HASH(0x55c49e4556c0), "XXX") called at /usr/share/perl/5.26/File/Find.pm line 760
	File::Find::find(HASH(0x55c49e4556c0), "XXX") called at piwigo_import_tree.pl line 121

Hence, I encounter the same error as @feretio : 413 Request Entity Too Large

For these tests I was using the docker image linuxserver/piwigo.

thanks @feretio your answer helped me solve it as well. to add some more details for non perlists: running the perl script with the debug flag (**-d**) starts an interactive debugger: `sudo perl -d piwigo_import_tree.pl --base-url=XXX --user=XXX --password=XXX --directory=XXX` then upon the next halt, pressing **c** continues until the error. Here the error is printed with more details and a stacktrace: ``` [album 4] "XXX" upload starts... malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<html>\r\n<head><tit...") at /usr/local/share/perl/5.26.1/JSON.pm line 187. at /usr/local/share/perl/5.26.1/JSON.pm line 187. JSON::from_json("<html>\x{d}\x{a}<head><title>413 Request Entity Too Large</title></he"...) called at piwigo_import_tree.pl line 366 main::add_photo("path", "XXX", "album_id", 4) called at piwigo_import_tree.pl line 445 main::add_to_piwigo() called at /usr/share/perl/5.26/File/Find.pm line 448 File::Find::_find_dir(HASH(0x55c49e4556c0), "XXX", 9) called at /usr/share/perl/5.26/File/Find.pm line 236 File::Find::_find_opt(HASH(0x55c49e4556c0), "XXX") called at /usr/share/perl/5.26/File/Find.pm line 760 File::Find::find(HASH(0x55c49e4556c0), "XXX") called at piwigo_import_tree.pl line 121 ``` Hence, I encounter the same error as @feretio : 413 Request Entity Too Large For these tests I was using the docker image linuxserver/piwigo. <!-- github-comment-id:392654275 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#713