-
Notifications
You must be signed in to change notification settings - Fork 238
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
Hangs indefinitely when exporting a password protected page (using --cookie) #250
Comments
Does it work on the command line? |
Hi, this is the command: additional info: this happens with useExec true or false and one more info: I just manually tried to execute the command above through php's shell_exec and it also hangs... I have no clue why. At least my MampPro seems to run as my personal account, so it should have all the permissions I have on the shell. I'm on MacOS btw, with the latest version of wkhtmltopdf and the latest version of your wrapper. cheers, |
When I read "Mamp" it always rings some alarm bells. In my experience this package has quite some limitations and misterous errors are common. So this is my first suspect in this case. It would be interesting to see if the problem also exists on a "real" server (i.e. some Linux/Unix like system). |
Hi mikehaertl, it does work on the command line. Im using a Windows server, does it have some sort of limitations on Windows servers? |
@davidnoguerol I have no idea as I never use any Windows system for app development/deployment. But the problem is probably related to this: mikehaertl/php-shellcommand#20 We use this library to execute EDIT: The fix I mean is the one proposed in my comment here mikehaertl/php-shellcommand#20 (comment). You'd have to manually modify the code in |
I tried the solution from the other ticket. It does not solve the issue. Same endless loading and the server hangs. I will also try on Linux, but I think we should not forget that this cookie option
is causing the problems. When you remove the cookie config, it works. Anything else I can try in this context? I also checked the return code of both commands (with and without cookie) on the shell, they are both 0. Also nothing else seems strange of the output of wkhtmltopdf, the only difference (in my case) is this single line: Can this be causing the problem? |
Hmm, I have no idea then. Did you try to add the What you could also try is to skip our library here and execute the same command string you use on the command line with |
I just tried quiet. Did not help. But amazingly with exec(..) it did work. (I tried shell_exec before, this did not work). Though I'm really sad to skip your lib, I have to say Thank You! P.S. If you want me to try something else with this information, feel free to contact me. |
@hiasl Ok, thanks. You could indeed try something for me. As you can see here when you use the
So the only difference I can see is, that the command is suffixed with a
If this also works I'd be quite confused. In this case it would be interesting if you could play around with the code from my https://github.com/mikehaertl/php-shellcommand a little to find out the difference. |
Oh, I misread that. So before trying what I just said, did you also try the |
Hi, my assumptions were wrong. I'm using your lib inside Yii 1.1 and this seems to be the problem. |
Sounds weird. There's nothing special going on in Yii so it should work the same there. Did you verify that |
Yes, I did. The full command I posted was taken from your class with a |
Ok, I'm running out of ideas. Maybe try to disable logging in Yii - but that should also not really make a difference. You'd probably have to go into the guts of Yii to find out more. |
When you create a PDF from a Yii 1.1 request with a session and the page to be converted also accesses this session (by passing the session ID as cookie), then 2 requests need to be processed at the same time. and yii 1.1 is not capable of that. It waits, until the first process has finished and would then complete the second one (the one from wkhtmltopdf). And this never happens :-) Solution: Before calling wkhtmltopdf close the session manually by calling |
Riiight, very nice. This has nothing to do with Yii, though, but is a common and well-known (but often forgotten 😄 ) issue with PHP's session. Just google for "PHP blocking sessions". The session file is locked while a request is being processed. So any simultaneous request using the same session will have to wait until the locked session file is released. I wonder a bit, why you want to send a request anyway. Why not simply render the HTML and generate the PDF from that. BTW I've even created a extension for Yii 1 that helps you with this - but to be honest it's not maintained anymore. So you're on your own if you want to use it: https://github.com/mikehaertl/pdfable |
@davidnoguerol Can you confirm that this is also the issue you have? As said above this is not limited to Yii. It's a general problem with session handling in PHP. |
wonderful, it worked in moodle as well. |
I'm currently facing an issue where, if I add --cookie as an argument and pass in a sessionid, the request hangs indefinitely. However, when remove the --cookie, it works just fine but then the page exported to PDF becomes the login page of the site. I'm unable to export pages that requires some sort of authentication.
Here's a snippet example:
Is this a known issue? Are you aware of any potential causes of this issue?
Thanks in advance
The text was updated successfully, but these errors were encountered: