#StackBounty: #php #arguments #wkhtmltoimage Argument list too long error for wkhtmltoimage

Bounty: 50

I want to capture the screen and store it to to the server. I have used the below command to achieve the screen capture in my php code.

$exec_command = "wkhtmltoimage --quality 10 --window-status 'wbcaptureready' --width 1200 --post 'estr' 
'JTNDVFZXQiUzRSUzQ3diJTIwc0lkJTNEJTIyd2I3NzYyNzVpeWFma3hya3Qy9UVldCJTNF' --post 'ispagehasdocument' '0' --height 1260 --enable-plugins --no-stop-slow-scripts https://example.org/page/capture/ '/data/screencapture/data/1234/1256/screenshots/screenshots/wbPage_^{4BEFBE59-EF14-4de4-9D08-3267BB76D8EA^}_0.png'";
$output = system($exec_command, $resCommand);

When I run the above code it works fine. But when I passed huge text of values to the parameter named estr it throws error code number 127(command can not found) when i echo the value of $resCommand. And also when I try to execute the command in the putty it throws error like below,

-bash: /usr/bin/wkhtmltoimage: Argument list too long

Based on the above error I surfed in the internet and I got suggestion like I have to increase the ARG_MAX value. But the suggestions were not clear and vague. I could not located the argument and how to increase the value.

Kindly suggest me where and how to increase the ARG_MAX value or kindly suggest me if any other solution is available to fix this issue?.

My OS version: – Linux version 2.6.32-696.6.3.el6.x86_64 (mockbuild@c1bl.rdu2.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) )

Thanks,
Ravichandran


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.