When attempting to upload a not-really-too-large-for-the-modern-internet PDF file (about 20MB) Scalar keeps timing out with the Javascript error message:
There was an error saving the file: SyntaxError: Unexpected token < in JSON at position 0
The app’s error_log shows a timeout - Maximum execution time of 300 seconds exceeded in /home/foo/public_html/bar/system/application/libraries/Image_Metadata.php
What I’ve done so far:
PHP INI - upped upload_max_filesize
to 512MB and post_max_size
to 1024MB just in case this was causing an issue, no joy, but didn’t expect this to be a problem
.htaccess - added php_value max_execution_time 600
- still no joy
There are 2 closed issues in the repo that seem to have been fixed with their releases:
JSON parsing error displayed to user when uploaded file is too large · Issue #24 · anvc/scalar · GitHub and Image_Metadata.php causing JS and AJAX errors on file upload · Issue #126 · anvc/scalar · GitHub
I seem to remember coming across this before but don’t remember what the fix was … also not sure why it’s going to take 5 minutes to upload 20MB? This has happened across multiple logins and locations, it was first brought to my attention by someone else outside our org attempting to use a demo site I was working with them on.
We’re on PHP 7.4