Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$this->numberOfPages = $this->imagick->getNumberImages(); causes Maximum execution time of 30 seconds exceeded #153

Closed
trevorpan opened this issue Jul 3, 2020 · 3 comments

Comments

@trevorpan
Copy link

trevorpan commented Jul 3, 2020

Have laravel medialibrary installed. It works fine for single page files. However a four page 8.5MB (and a smaller 2.5MB of the same file) pdf throws this:

Maximum execution time of 30 seconds exceeded or 502 Bad Gateway

Single page files do not throw the error.

#16
spatie/laravel-medialibrary#1271
http://www.imagemagick.org/discourse-server/viewtopic.php?t=19087

Tried out a ton possible issues, but the error always comes back to a method in vendor/spatie/pdf-to-image/src/Pdf.php file.

Here's the versions I'm using:
"spatie/laravel-medialibrary": "^7",
"spatie/pdf-to-image": "2.0.1",

Laravel 7
GPL Ghostscript 9.50 (2019-10-15)

php.ini
upload_max_filesize = 32M
max_file_uploads = 20
post_max_size = 128M
memory_limit = 2048M
extension="redis.so"
extension="imagick.so"

Laravel Valet 2.11.0
Can verify valet uses php@7.3
Have verified the server is using php@7.3
laravel/valet#728 (comment) (this was a big pain, and a great find)

Have gone through all the possibilities I can find.

@trevorpan
Copy link
Author

trevorpan commented Jul 6, 2020

This one took a few days to pin down. https://laracasts.com/discuss/channels/code-review/maximum-execution-time-of-30-seconds-exceeded-spatie-medialibrary?page=1#reply=621931

Basically, the policy.xml on imagemagick had a setting for pdf which needed read | write permissions. That was part of it, but also on local I use QUEUE_CONNECTION=sync but that was forcing the conversion so I found changing to redis - at least for this attempt - on local really helped as horizon could take the job...

@freekmurze is it a fair tip on the docs to reference this setting in policy.xml? (for future users of this package and medialibary)

<policy domain="coder" rights="read | write" pattern="PDF" />

@freekmurze
Copy link
Member

Sure, send a PR for this

@trevorpan
Copy link
Author

@freekmurze not sure if the fix I suggested made it through? I thought I forked the README and suggested changes with a PR. Did that work? (first time pr'er)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants