Hello, I am trying to create a screen capture program with Xvfb server, ImageMagick and Khtml2PNG.
I seem to be having some issues and was hoping someone could help me out.
I have everything installed and working on a centos WHM/CPanel system and am able to generate the screen shots and save them to root folder from shell with the following commands.
Xvfb :2 -screen 0 1024x768x24&
export DISPLAY=localhost:2.0
khtml2png2 --sw 200 --sh 150
http://www.example.com example.png
It works 100% fine when you run it from shell.
I have created the following php script to run the exact same commands but get no results.
$connection = ssh2_connect('xxxxxxxxxxxxxx', 22);
ssh2_auth_password($connection, 'root', 'xxxxxxxxxxxxxx');
$stream = ssh2_exec($connection, 'Xvfb :2 -screen 0 1024x768x24&');
sleep(15);
$stream = ssh2_exec($connection, 'export DISPLAY=localhost:2.0');
sleep(2);
$stream = ssh2_exec($connection, 'khtml2png2 --sw 200 --sh 150
http://www.example.com example.png');
sleep(7);
echo "All done!";
Does anyone know why this would work fine from shell but NOT work at all when I run it from the php script?
Thanks in advance!