Question

Executing wkhtmltoimage from PHP it just hangs.

$command = 'wkhtmltoimage --format "png" "' . $url . '" "' . $output . '"';
exec($command);

It hangs until PHP times out.

I can run the same command from the CLI directly and it works fine.

I have also tried:

  • adding 2>&1 and >nul 2>&1.
  • using shell_exec and backticks.
  • wrapping the exec in a batch file and calling EXIT /B 0

I tried using Symfony Process instead and get this error:

Qt: Untested Windows version 6.2 detected!

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Running it from the CLI produces the same Qt: Untested Windows version 6.2 detected! message, but the image is still generated. Running it from PHP just won't generate the image.

Any idea how to make wkhtmltoimage work from PHP?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top