execute command line in PHP?

Help
Jay Resi
2009-08-21
2012-12-15
  • Jay Resi
    Jay Resi
    2009-08-21

    Hi,
    khtml2png2 works fine in the command line, but it could not be executed in php. my php script:

    <?php

    $command = '/usr/local/bin/khtml2png2 --display :0.0 http://google.com /tmp/google.png';
    shell_exec($command);

    ?>

    Any ideas? Any settings need to be done to enable php on a server level?

    Thanks heaps.

     
    • khtml2png requires a X server (because it relies on the kdelibs). So, you must be sure a X server is running and add the DISPLAY environment variable when invoking khtml2png.

      Too enable khtml2png on a server, I strongly recommend khtmld (http://wiki.goatpr0n.de/projects/khtmld). The home page of this projects contains configuration example and some hints.