0

I'm trying to run CutyCapt on my CentOS server, to take websites screenshots!

The problem is that the command "/downloads/cutycapt/CutyCapt/CutyCapt --url=http://www.google.dk --out=/downloads/cutycapt/CutyCapt/test2.png --min-width=800 --min-height=600" works when I run it from command line!

But if I try to run it, inside the PHP exec function, nothing happen, and it also returns nothing.

UPDATED:

The command bellow works on shell.

rm -rf /tmp/.X4-lock&Xvfb :1 -fp /usr/share/X11/fonts/misc -screen 0 1024x768x24 &export DISPLAY=localhost:1.0&CutyCapt --url=http://www.scrapee.net --out=/downloads/cutycapt/CutyCapt/test4.png

but the code bellow donot work on php exec('rm -rf /tmp/.X4-lock&Xvfb :1 -fp /usr/share/X11/fonts/misc -screen 0 1024x768x24 &export DISPLAY=localhost:1.0&CutyCapt --url=http://www.scrapee.net --out=/downloads/cutycapt/CutyCapt/test4.png',$out);

Safe mode is off. So I really don't know what I'm doing wrong.

Could someone help-me please? Thank you.

3 Answers 3

1

CutyCapt needs an X server to work. If you are running it from the CLI as your own user, chances are you already have an X server running for your user. This X server cannot be directly used by the web server user. Start an X server for the web server user and change the DISPLAY environment variable in the beginning of yor PHP script to use this X server.

If this is a server without a screen, consider using Xfvb which is a headless X server.

Sign up to request clarification or add additional context in comments.

Comments

0

Could be a permissions problem

sudo chown www-data:www-data your_file.php

1 Comment

When I run whoami in the script I get "nobody". Could this be the problem?
0

Using CutyCapt without X server

You cannot use CutyCapt without an X server, but you can use e.g. Xvfb as light-weight server if you are not running an interactive graphical desktop environment. For example, you could use:

  % xvfb-run --server-args="-screen 0, 1024x768x24" ./CutyCapt --url=... --out=...

http://cutycapt.sourceforge.net/

2 Comments

I'm already using Xvfb. The problem is that it works on command line, but donot work on exec()
your trying to remove /tmp/.X4-lock, who is the owner for this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.