0

I am trying to take screenshot like this:

shell_exec("/usr/bin/wkhtmltoimage http://google.com screen.png");

But it is not creating screen.png. But when I run /usr/bin/wkhtmltoimage http://google.com screen.png from terminal it works as expected. I am confused what is wrong. I tried to write log like:

shell_exec("/usr/bin/wkhtmltoimage http://google.com screen.png > debug.log 2>&1");

I get log "QXcbConnection: Could not connect to display Aborted (core dumped)" on debug.log. I have php7.0 installed with Nginx on Ubuntu. What would be the solution for this? Please share if someone solved the same.

bhattraideb
  • 407
  • 7
  • 25
  • Access rights, probably. – Déjà vu May 14 '18 at 05:31
  • I found the solution here: https://stackoverflow.com/questions/9604625/wkhtmltopdf-cannot-connect-to-x-server. But working for pdf only. when I create png, jpg image, it created but blank image. – bhattraideb May 14 '18 at 05:46

0 Answers0